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