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:
Dmitriy Rabotyagov
2025-08-21 15:31:08 +02:00
parent 5813f8eabc
commit 5fc6d1fd4c

View File

@@ -13,30 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# This playbook is typically used with the following ansible-playbook
# arguments:
# * `-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 }}"
- name: Import openstack.osa.tools.set_haproxy_backends_state
ansible.builtin.import_playbook: openstack.osa.tools.set_haproxy_backends_state