ansible-playbooks/haproxy/pkg.ansible.yml

34 lines
829 B
YAML

- hosts: localhost
vars_files:
- map.yml
tasks:
- name: Install haproxy pkg
package:
state: present
name:
- haproxy
- name: Setup haproxy conf.d directory
file:
state: directory
path: /etc/haproxy/conf.d
owner: root
group: root
mode: '0755'
- name: 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: 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 }}"