2015-07-17 12:20:31 +02:00
|
|
|
---
|
2016-03-15 13:49:27 +00:00
|
|
|
- name: Setting sysctl values
|
|
|
|
sysctl: name={{ item.name }} value={{ item.value }} sysctl_set=yes
|
|
|
|
with_items:
|
|
|
|
- { name: "net.ipv4.ip_nonlocal_bind", value: 1}
|
|
|
|
- { name: "net.unix.max_dgram_qlen", value: 128}
|
2015-11-05 03:27:57 +00:00
|
|
|
when: set_sysctl | bool
|
2015-07-24 14:59:25 +00:00
|
|
|
|
2015-12-18 19:40:48 +00:00
|
|
|
- name: Ensuring config directories exist
|
2015-07-24 14:59:25 +00:00
|
|
|
file:
|
2017-01-23 11:39:01 -03:00
|
|
|
path: "{{ node_config_directory }}/{{ item.key }}"
|
2015-07-24 14:59:25 +00:00
|
|
|
state: "directory"
|
2015-12-18 19:40:48 +00:00
|
|
|
recurse: yes
|
2017-01-23 11:39:01 -03:00
|
|
|
when:
|
|
|
|
- inventory_hostname in groups[item.value.group]
|
|
|
|
- item.value.enabled | bool
|
|
|
|
with_dict: "{{ haproxy_services }}"
|
2015-12-18 19:40:48 +00:00
|
|
|
|
|
|
|
- name: Copying over config.json files for services
|
|
|
|
template:
|
2017-01-23 11:39:01 -03:00
|
|
|
src: "{{ item.key }}.json.j2"
|
|
|
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
|
|
|
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
|
2015-07-24 14:59:25 +00:00
|
|
|
|
2015-12-18 19:40:48 +00:00
|
|
|
- name: Copying over haproxy.cfg
|
2017-01-23 11:39:01 -03:00
|
|
|
vars:
|
|
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
2015-09-25 09:19:07 +00:00
|
|
|
template:
|
2016-09-12 18:36:33 +02:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ node_config_directory }}/haproxy/haproxy.cfg"
|
2017-01-23 11:39:01 -03:00
|
|
|
register: haproxy_cfg
|
|
|
|
when:
|
|
|
|
- inventory_hostname in groups[service.group]
|
|
|
|
- service.enabled | bool
|
2016-09-12 18:36:33 +02:00
|
|
|
with_first_found:
|
|
|
|
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy.cfg"
|
|
|
|
- "{{ node_custom_config }}/haproxy/haproxy.cfg"
|
|
|
|
- "haproxy.cfg.j2"
|
2017-01-23 11:39:01 -03:00
|
|
|
notify:
|
|
|
|
- Restart haproxy container
|
|
|
|
- Ensuring latest haproxy config is used
|
2015-09-25 09:19:07 +00:00
|
|
|
|
2015-12-18 19:40:48 +00:00
|
|
|
- name: Copying over keepalived.conf
|
2017-01-23 11:39:01 -03:00
|
|
|
vars:
|
|
|
|
service: "{{ haproxy_services['keepalived'] }}"
|
2015-07-24 14:59:25 +00:00
|
|
|
template:
|
2016-09-12 18:32:52 +02:00
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
|
2017-01-23 11:39:01 -03:00
|
|
|
register: keepalived_conf
|
|
|
|
when:
|
|
|
|
- inventory_hostname in groups[service.group]
|
|
|
|
- service.enabled | bool
|
2016-09-12 18:32:52 +02:00
|
|
|
with_first_found:
|
|
|
|
- "{{ node_custom_config }}/keepalived/{{ inventory_hostname }}/keepalived.conf"
|
|
|
|
- "{{ node_custom_config }}/keepalived/keepalived.conf"
|
|
|
|
- "keepalived.conf.j2"
|
2017-01-23 11:39:01 -03:00
|
|
|
notify:
|
|
|
|
- Restart keepalived container
|
2016-02-29 13:51:11 -05:00
|
|
|
|
|
|
|
- name: Copying over haproxy.pem
|
2017-01-23 11:39:01 -03:00
|
|
|
vars:
|
|
|
|
service: "{{ haproxy_services['haproxy'] }}"
|
2016-02-29 13:51:11 -05:00
|
|
|
copy:
|
|
|
|
src: "{{ kolla_external_fqdn_cert }}"
|
|
|
|
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
2017-01-23 11:39:01 -03:00
|
|
|
register: haproxy_pem
|
|
|
|
when:
|
|
|
|
- kolla_enable_tls_external | bool
|
|
|
|
- inventory_hostname in groups[service.group]
|
|
|
|
- service.enabled | bool
|
2016-02-29 13:51:11 -05:00
|
|
|
with_items:
|
|
|
|
- "haproxy.pem"
|
2017-01-23 11:39:01 -03:00
|
|
|
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 }}"
|
2017-03-31 12:51:54 +01:00
|
|
|
privileged: "{{ item.value.privileged | default(False) }}"
|
2017-01-23 11:39:01 -03:00
|
|
|
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"
|