- hosts: localhost vars_files: - map.yml tasks: - name: "haproxy/pkg : Install haproxy pkg" package: state: present name: - haproxy - name: "haproxy/pkg : Setup haproxy conf.d directory" file: state: directory path: /etc/haproxy/conf.d owner: root group: root mode: "0755" - name: "haproxy/pkg : Populate haproxy config" template: src: files/haproxy_config.j2 dest: /etc/haproxy/haproxy.cfg owner: root group: root mode: "0644" vars: IPV4: "{{ ansible_default_ipv4.address }}" - name: "haproxy/pkg : Populate haproxy rc-script" template: src: files/haproxy_rcscript.initd.j2 dest: /etc/init.d/haproxy owner: root group: root mode: "0755" vars: CONF_DIR: "{{ conf_dir }}"