Move set-haproxy-backends-state content to collection
With promotion of the playbook to main collection, let's perform an import for backwards compatability instead of full playbook content. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/958198 Change-Id: I7aa550b717cc91a12646e7ccceca0ffd39b592e5 Signed-off-by: Dmitriy Rabotyagov <noonedeadpunk@gmail.com>
This commit is contained in:
@@ -13,30 +13,5 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# This playbook is typically used with the following ansible-playbook
|
- name: Import openstack.osa.tools.set_haproxy_backends_state
|
||||||
# arguments:
|
ansible.builtin.import_playbook: openstack.osa.tools.set_haproxy_backends_state
|
||||||
# * `-e hostname=<host>`
|
|
||||||
# * `-e backend_state=<enabled|disabled>`
|
|
||||||
# in order to globally enable/disable a controller at the HAProxy level.
|
|
||||||
|
|
||||||
- name: Set HAProxy backends state
|
|
||||||
hosts: haproxy
|
|
||||||
vars:
|
|
||||||
- hostname: ""
|
|
||||||
- backend_state: enabled
|
|
||||||
tasks:
|
|
||||||
- name: List HAProxy backends to process
|
|
||||||
ansible.builtin.shell: echo show servers state | nc -U /var/run/haproxy.stat | awk '{print $4}' | grep '^{{ hostname }}' | sort | uniq
|
|
||||||
register: backends
|
|
||||||
changed_when: false
|
|
||||||
- name: Loop through backends to set state
|
|
||||||
community.general.haproxy:
|
|
||||||
host: "{{ item }}"
|
|
||||||
state: "{{ backend_state }}"
|
|
||||||
socket: /var/run/haproxy.stat
|
|
||||||
drain: "{{ haproxy_drain | default(False) }}"
|
|
||||||
shutdown_sessions: "False"
|
|
||||||
wait: "True"
|
|
||||||
wait_interval: "{{ haproxy_wait_interval | default(5) }}"
|
|
||||||
wait_retries: "{{ haproxy_wait_retries | default(24) }}"
|
|
||||||
with_items: "{{ backends.stdout_lines }}"
|
|
||||||
|
Reference in New Issue
Block a user