--- - 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 - 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' - name: start haproxy service systemd: name: haproxy state: started enabled: yes daemon_reload: yes