2021-01-09 17:54:42 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: install haproxy
|
|
|
|
package:
|
|
|
|
name: haproxy
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: add haproxy config
|
|
|
|
copy:
|
|
|
|
content: "{{ haproxy_config }}"
|
|
|
|
dest: "/etc/haproxy/haproxy.cfg"
|
|
|
|
notify:
|
|
|
|
- restart haproxy
|
|
|
|
when: haproxy_config is defined
|
|
|
|
|
2024-06-16 14:39:10 +00:00
|
|
|
- name: set haproxy_connect_any flag on and keep it persistent across reboots
|
|
|
|
ansible.posix.seboolean:
|
|
|
|
name: haproxy_connect_any
|
|
|
|
state: yes
|
|
|
|
persistent: yes
|
|
|
|
when: ansible_selinux is defined and ansible_selinux != False and ansible_selinux.status == 'enabled'
|
|
|
|
|
2021-01-09 17:54:42 +00:00
|
|
|
- name: start haproxy service
|
|
|
|
systemd:
|
|
|
|
name: haproxy
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
daemon_reload: yes
|
|
|
|
|