kolla-ansible/ansible/roles/haproxy/tasks/config.yml
Eduardo Gonzalez ea1a1dee0d Verify YAML syntax in gates
This patchset implements yamllint test to all *.yml
files.

Also fixes syntax errors to make jobs to pass.

Change-Id: I3186adf9835b4d0cada272d156b17d1bc9c2b799
2018-03-26 17:56:22 +02:00

112 lines
3.2 KiB
YAML

---
- name: Setting sysctl values
sysctl: name={{ item.name }} value={{ item.value }} sysctl_set=yes
become: true
with_items:
- { name: "net.ipv4.ip_nonlocal_bind", value: 1}
- { name: "net.unix.max_dgram_qlen", value: 128}
when: set_sysctl | bool
- 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: 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
register: haproxy_config_jsons
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ haproxy_services }}"
notify:
- "Restart {{ item.key }} container"
- Ensuring latest haproxy config is used
- name: Copying over haproxy.cfg
vars:
service: "{{ haproxy_services['haproxy'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/haproxy/haproxy.cfg"
mode: "0660"
become: true
register: haproxy_cfg
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy.cfg"
- "{{ node_custom_config }}/haproxy/haproxy.cfg"
- "haproxy.cfg.j2"
notify:
- Restart haproxy container
- Ensuring latest haproxy config is used
- name: Copying over keepalived.conf
vars:
service: "{{ haproxy_services['keepalived'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
mode: "0660"
become: true
register: keepalived_conf
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
register: haproxy_pem
when:
- kolla_enable_tls_external | bool
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_items:
- "haproxy.pem"
notify:
- Restart haproxy container
- Ensuring latest haproxy config is used
- name: Check haproxy containers
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
volumes: "{{ item.value.volumes }}"
privileged: "{{ item.value.privileged | default(False) }}"
register: check_haproxy_containers
when:
- action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ haproxy_services }}"
notify:
- "Restart {{ item.key }} container"