--- # HAPROXY - name: Install haproxy package: name: haproxy state: latest - name: Copy haproxy configuration copy: src: haproxy.cfg dest: /etc/haproxy/haproxy.cfg backup: no register: haproxy_configuration - name: Restart haproxy service: name: haproxy state: restarted when: haproxy_configuration.changed - name: Ensure that haproxy is running service: name: haproxy state: running # KEEPALIVED - name: Install keepalived package: name: keepalived state: latest - name: Copy keepalived config template: src: keepalived.conf dest: /etc/keepalived/keepalived.conf backup: no register: keepalived_configuration - name: Restart keepalived service: name: keepalived state: restarted when: keepalived_configuration.changed - name: Ensure keepalived is running service: name: keepalived state: running