
Currently, we have a lot of logic for checking if a handler should run, depending on whether config files have changed and whether the container configuration has changed. As rm_work pointed out during the recent haproxy refactor, these conditionals are typically unnecessary - we can rely on Ansible's handler notification system to only trigger handlers when they need to run. This removes a lot of error prone code. This patch removes conditional handler logic for all services. It is important to ensure that we no longer trigger handlers when unnecessary, because without these checks in place it will trigger a restart of the containers. Implements: blueprint simplify-handlers Change-Id: I4f1aa03e9a9faaf8aecd556dfeafdb834042e4cd
214 lines
6.3 KiB
YAML
214 lines
6.3 KiB
YAML
---
|
|
- name: Setting sysctl values
|
|
become: true
|
|
sysctl: name={{ item.name }} value={{ item.value }} sysctl_set=yes
|
|
with_items:
|
|
- { name: "net.bridge.bridge-nf-call-iptables", value: 1}
|
|
- { name: "net.bridge.bridge-nf-call-ip6tables", value: 1}
|
|
- { name: "net.ipv4.conf.all.rp_filter", value: 0}
|
|
- { name: "net.ipv4.conf.default.rp_filter", value: 0}
|
|
when:
|
|
- set_sysctl | bool
|
|
- inventory_hostname in groups['opendaylight']
|
|
|
|
- name: Ensuring config directories exist
|
|
file:
|
|
path: "{{ node_config_directory }}/{{ item }}"
|
|
state: "directory"
|
|
owner: "{{ config_owner_user }}"
|
|
group: "{{ config_owner_group }}"
|
|
mode: "0770"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
|
|
- name: Copying over config.json files for services
|
|
template:
|
|
src: "{{ item }}.json.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over custom.properties
|
|
template:
|
|
src: "{{ role_path }}/templates/custom.properties.j2"
|
|
dest: "{{ node_config_directory }}/opendaylight/custom.properties"
|
|
mode: "0660"
|
|
become: true
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over start-odl
|
|
template:
|
|
src: "{{ role_path }}/templates/start-odl.j2"
|
|
dest: "{{ node_config_directory }}/opendaylight/start-odl"
|
|
mode: "0660"
|
|
become: true
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over jetty.xml
|
|
template:
|
|
src: "{{ role_path }}/templates/jetty.xml.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/jetty.xml"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over org.apache.karaf.features.cfg
|
|
template:
|
|
src: "{{ role_path }}/templates/org.apache.karaf.features.cfg.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/org.apache.karaf.features.cfg"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over org.opendaylight.ovsdb.library.cfg
|
|
template:
|
|
src: "{{ role_path }}/templates/org.opendaylight.ovsdb.library.cfg.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/org.opendaylight.ovsdb.library.cfg"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over tomcat-server.xml
|
|
template:
|
|
src: "{{ role_path }}/templates/tomcat-server.xml.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/tomcat-server.xml"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over org.ops4j.pax.logging.cfg.j2
|
|
template:
|
|
src: "{{ role_path }}/templates/org.ops4j.pax.logging.cfg.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/org.ops4j.pax.logging.cfg"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over netvirt-impl-config_netvirt-impl-config.xml
|
|
template:
|
|
src: "{{ role_path }}/templates/netvirt-impl-config_netvirt-impl-config.xml.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/netvirt-impl-config_netvirt-impl-config.xml"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over netvirt-aclservice-config.xml
|
|
template:
|
|
src: "{{ role_path }}/templates/netvirt-aclservice-config.xml.j2"
|
|
dest: "{{ node_config_directory }}/{{ item }}/netvirt-aclservice-config.xml"
|
|
mode: "0660"
|
|
become: true
|
|
with_items:
|
|
- "opendaylight"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over setenv
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/opendaylight/setenv"
|
|
mode: "0660"
|
|
become: true
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/setenv"
|
|
- "{{ node_custom_config }}/opendaylight/setenv"
|
|
- "{{ role_path }}/templates/setenv.j2"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over akka.conf
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/opendaylight/akka.conf"
|
|
mode: "0660"
|
|
become: true
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/akka.conf"
|
|
- "{{ node_custom_config }}/opendaylight/akka.conf"
|
|
- "akka.conf.j2"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over modules.conf
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/opendaylight/modules.conf"
|
|
mode: "0660"
|
|
become: true
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/modules.conf"
|
|
- "{{ node_custom_config }}/opendaylight/modules.conf"
|
|
- "modules.conf.j2"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over module-shards.conf
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/opendaylight/module-shards.conf"
|
|
mode: "0660"
|
|
become: true
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/module-shards.conf"
|
|
- "{{ node_custom_config }}/opendaylight/module-shards.conf"
|
|
- "module-shards.conf.j2"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Copying over 10-rest-connector.xml
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: "{{ node_config_directory }}/opendaylight/10-rest-connector.xml"
|
|
mode: "0660"
|
|
become: true
|
|
with_first_found:
|
|
- "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/10-rest-connector.xml"
|
|
- "{{ node_custom_config }}/opendaylight/10-rest-connector.xml"
|
|
- "10-rest-connector.xml.j2"
|
|
notify:
|
|
- Restart opendaylight container
|
|
|
|
- name: Check opendaylight containers
|
|
become: true
|
|
kolla_docker:
|
|
action: "compare_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ item.value.container_name }}"
|
|
image: "{{ item.value.image }}"
|
|
privileged: "{{ item.value.privileged | default(False) }}"
|
|
volumes: "{{ item.value.volumes }}"
|
|
dimensions: "{{ item.value.dimensions }}"
|
|
tty: "{{ item.value.tty }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- item.value.enabled | bool
|
|
- item.value.host_in_groups | bool
|
|
with_dict: "{{ opendaylight_services }}"
|
|
notify:
|
|
- "Restart {{ item.key }} container"
|