Files
configpolicy/roles/haproxy/tasks/main.yml
Dustin C. Hatch 29ef364fab r/haproxy: Clean up for modern haproxy versions
The current version of *haproxy* packaged in Fedora already enables
configuration via fragments in a drop-in directory, though it uses
a different path by default.  I still like separating the global
configuration from the defaults, though, and keeping the main
`haproxy.cfg` file empty.
2024-06-12 18:28:16 -05:00

46 lines
960 B
YAML

- name: load distribution-specific values
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}.yml'
- defaults.yml
- name: ensure haproxy is installed
package:
name=haproxy
state=present
tags:
- install
- name: ensure default haproxy configuration file is empty
copy:
src: haproxy.cfg
dest: /etc/haproxy
mode: u=rw,go=r
notify: restart haproxy
- name: ensure haproxy global configuration is set
template:
src: global.cfg.j2
dest: /etc/haproxy/conf.d/10-global.cfg
mode: u=rw,go=r
notify: restart haproxy
- name: ensure haproxy defaults are set
template:
src: defaults.cfg.j2
dest: /etc/haproxy/conf.d/20-defaults.cfg
mode: u=rw,go=r
notify: restart haproxy
- name: ensure haproxy starts at boot
service:
name: haproxy
enabled: true
tags:
- service
- name: ensure haproxy is running
service:
name: haproxy
state: started
tags:
- service