tasks:
+ - name: "Made basic checks for HAProxy."
+ include_role:
+ name: haproxy-check-initial
+
- name: "Get the LDAP server to disable replication:"
ansible.builtin.set_fact:
ldapserver_to_disable: "{{ hostvars.localhost.ldapserver_to_disable }}"
msg: "The given host '{{ ldapserver_to_enable }}' is not a valid LDAP server."
when: found_ldapserver == false
+- name: "Initial checks for the HAProxy."
+ hosts: haproxy_servers
+ gather_facts: false
+
+ tasks:
+
+ - name: "Made basic checks for HAProxy."
+ include_role:
+ name: haproxy-check-initial
+
- name: "Enabling Replication on a particular LDAP server."
hosts: ldap_servers
gather_facts: false
--- /dev/null
+---
+
+haproxy_backend_name: 'be'
+haproxy_admin_socket: '/run/haproxy/admin.sock'
+haproxy_operator_socket: '/run/haproxy/operator.sock'
+haproxy_user_socket: '/run/haproxy/user.sock'
+
+# vim: filetype=yaml
--- /dev/null
+---
+
+# Role for Initial checks of a HAProxy installation
+
+- name: "Exec command for retrieving version of HAProxy."
+ ansible.builtin.shell: "haproxy -v | grep -i -P '^HAProxy\\s+version' | sed -e 's/^HAProxy[ ][ ]*version[ ][ ]*//' -e 's/[ ].*//'"
+ register: get_haproxy_version
+ check_mode: false
+ changed_when: false
+
+- name: "Checking results of getting the HAProxy version."
+ debug:
+ var: get_haproxy_version
+ verbosity: 2
+
+- name: "Get the version of the HAProxy."
+ ansible.builtin.set_fact:
+ version_haproxy: "{{ get_haproxy_version.stdout }}"
+ cacheable: true
+
+- name: "Show version of HAProxy."
+ debug:
+ var: version_haproxy
+ verbosity: 0
+
+- name: "Fail for non existing HAProxy."
+ ansible.builtin.fail:
+ msg: "No HAProxy server found on host '{{ inventory_hostname }}'."
+ when: version_haproxy == ''
+
+# vim: filetype=yaml