deploy_haproxy/tasks/configure.yml

45 lines
1.4 KiB
YAML

---
# 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"
- 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 }}"
dest: "{{ deploy_haproxy_cert_dir_dst }}/{{ (item | basename) }}"
owner: "{{ deploy_haproxy_user }}"
group: "{{ deploy_haproxy_group }}"
mode: "0600"
with_fileglob:
- "{{ deploy_haproxy_cert_dir }}/*"