4d155d69cd
Refactor service configuration to use the copy certificates task. This reduces code duplication and simplifies implementing encrypting backend HAProxy traffic for individual services. Change-Id: I0474324b60a5f792ef5210ab336639edf7a8cd9e
152 lines
4.2 KiB
YAML
152 lines
4.2 KiB
YAML
---
|
|
- name: Ensuring config directories exist
|
|
file:
|
|
path: "{{ node_config_directory }}/{{ item.key }}"
|
|
state: "directory"
|
|
owner: "{{ config_owner_user }}"
|
|
group: "{{ config_owner_group }}"
|
|
mode: "0770"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[item.value.group]
|
|
- item.value.enabled | bool
|
|
with_dict: "{{ haproxy_services }}"
|
|
|
|
- name: Ensuring service config subdir exists
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
file:
|
|
path: "{{ node_config_directory }}/haproxy/services.d"
|
|
state: "directory"
|
|
owner: "{{ config_owner_user }}"
|
|
group: "{{ config_owner_group }}"
|
|
mode: "0770"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
|
|
- name: Copying over config.json files for services
|
|
template:
|
|
src: "{{ item.key }}.json.j2"
|
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[item.value.group]
|
|
- item.value.enabled | bool
|
|
with_dict: "{{ haproxy_services }}"
|
|
notify:
|
|
- "Restart {{ item.key }} container"
|
|
|
|
- name: Copying over haproxy.cfg
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/haproxy/haproxy.cfg"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_main.cfg"
|
|
- "{{ node_custom_config }}/haproxy/haproxy_main.cfg"
|
|
- "haproxy_main.cfg.j2"
|
|
notify:
|
|
- Restart haproxy container
|
|
|
|
- name: Copying over custom haproxy services configuration
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/haproxy/services.d/"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_fileglob:
|
|
- "{{ node_custom_config }}/haproxy/services.d/*.cfg"
|
|
notify:
|
|
- Restart haproxy container
|
|
|
|
- name: Copying over keepalived.conf
|
|
vars:
|
|
service: "{{ haproxy_services['keepalived'] }}"
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/keepalived/{{ inventory_hostname }}/keepalived.conf"
|
|
- "{{ node_custom_config }}/keepalived/keepalived.conf"
|
|
- "keepalived.conf.j2"
|
|
notify:
|
|
- Restart keepalived container
|
|
|
|
- name: Copying over haproxy.pem
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
copy:
|
|
src: "{{ kolla_external_fqdn_cert }}"
|
|
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- kolla_enable_tls_external | bool
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_items:
|
|
- "haproxy.pem"
|
|
notify:
|
|
- Restart haproxy container
|
|
|
|
- name: Copying over haproxy-internal.pem
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
copy:
|
|
src: "{{ kolla_internal_fqdn_cert }}"
|
|
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
|
mode: "0660"
|
|
become: true
|
|
when:
|
|
- kolla_enable_tls_internal | bool
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_items:
|
|
- "haproxy-internal.pem"
|
|
notify:
|
|
- Restart haproxy container
|
|
|
|
- include_tasks: copy-certs.yml
|
|
when:
|
|
- kolla_copy_ca_into_containers | bool
|
|
|
|
- name: Copying over haproxy start script
|
|
vars:
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/haproxy/haproxy_run.sh"
|
|
mode: "0770"
|
|
become: true
|
|
when:
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_run.sh"
|
|
- "{{ node_custom_config }}/haproxy/haproxy_run.sh"
|
|
- "haproxy_run.sh.j2"
|
|
notify:
|
|
- Restart haproxy container
|
|
|
|
- include_tasks: check-containers.yml
|
|
when: kolla_action != "config"
|