Files
2026-04-08 11:22:12 -04:00

32 lines
678 B
YAML

---
- name: Load OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}.yml"
- "default.yml"
- name: Install HAProxy
package:
name: "{{ haproxy_package }}"
state: present
- name: Ensure configuration directory exists
file:
path: "{{ haproxy_config_path | dirname }}"
state: directory
mode: '0755'
- name: Deploy HAProxy configuration
template:
src: haproxy.cfg.j2
dest: "{{ haproxy_config_path }}"
validate: "haproxy -c -f %s"
notify: reload haproxy
- name: Ensure HAProxy is started and enabled
service:
name: "{{ haproxy_service_name }}"
state: started
enabled: yes