2024-01-31 20:01:49 +00:00
|
|
|
---
|
|
|
|
# task/configure file for deploy_haproxy
|
|
|
|
- name: "Configure for host installation"
|
|
|
|
when: deploy_haproxy_deploy_method == 'host'
|
|
|
|
block:
|
|
|
|
- name: "Create haproxy.env"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: haproxy.env.j2
|
|
|
|
dest: "{{ deploy_haproxy_config_dir }}/haproxy.env"
|
|
|
|
owner: "{{ deploy_haproxy_user }}"
|
|
|
|
group: "{{ deploy_haproxy_group }}"
|
|
|
|
mode: "0600"
|
|
|
|
|
|
|
|
- name: "Copy haproxy.cfg template"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: haproxy.cfg.j2
|
|
|
|
dest: "{{ deploy_haproxy_config_dir }}/haproxy.cfg"
|
|
|
|
owner: "{{ deploy_haproxy_user }}"
|
|
|
|
group: "{{ deploy_haproxy_group }}"
|
|
|
|
mode: "0600"
|
|
|
|
notify:
|
|
|
|
- "systemctl-enable-haproxy"
|
|
|
|
- "systemctl-restart-haproxy"
|
2024-02-02 19:29:00 +00:00
|
|
|
|
|
|
|
- name: "Configure haproxy for TLS"
|
|
|
|
when: not deploy_haproxy_cert_dir == ''
|
|
|
|
block:
|
|
|
|
- name: "Create directory {{ deploy_haproxy_cert_dir_dst }}"
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ deploy_haproxy_cert_dir_dst }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ deploy_haproxy_user }}"
|
|
|
|
group: "{{ deploy_haproxy_group }}"
|
|
|
|
mode: "0755"
|
|
|
|
|
|
|
|
- name: "Copy TLS certificates"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
2024-02-02 22:42:53 +00:00
|
|
|
dest: "{{ deploy_haproxy_cert_dir_dst }}/{{ (item | basename) }}"
|
2024-02-02 19:29:00 +00:00
|
|
|
owner: "{{ deploy_haproxy_user }}"
|
|
|
|
group: "{{ deploy_haproxy_group }}"
|
|
|
|
mode: "0600"
|
|
|
|
with_fileglob:
|
|
|
|
- "{{ deploy_haproxy_cert_dir }}/*"
|