---
- hosts: all
tasks:
- name: install haproxy
apt:
name: haproxy
state: present
- name: copy haproxy config
copy:
src: haproxy.cfg
dest: /etc/haproxy/haproxy.cfg
- name: restart haproxy
service:
state: restarted
enabled: yes