Filter services dictionary per host
To greatly reduce the amount of log noise from skipped tasks, set a fact upfront in the role that filters the 'neutron_services' dict to one that only contains services relevant for each host. Change-Id: I66aadb8f75cbfdfd75dea6d9f96501072cf04d3c
This commit is contained in:
parent
baed87967f
commit
0a0f082e2f
@ -41,6 +41,19 @@
|
|||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
- name: Set filtered dictionary of neutron services
|
||||||
|
set_fact:
|
||||||
|
filtered_neutron_services: >
|
||||||
|
{%- set services = neutron_services.copy() %}
|
||||||
|
{%- for key,value in neutron_services.items() %}
|
||||||
|
{%- if value.group not in group_names or not value.service_en %}
|
||||||
|
{%- set _ = services.pop(key) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- services -}}
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
- include: neutron_ml2_ovs_powervm.yml
|
- include: neutron_ml2_ovs_powervm.yml
|
||||||
static: no
|
static: no
|
||||||
when:
|
when:
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
service:
|
service:
|
||||||
name: "{{ item.value.service_name }}"
|
name: "{{ item.value.service_name }}"
|
||||||
enabled: "yes"
|
enabled: "yes"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when:
|
|
||||||
- inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
- "{{ item.value.service_en | default(true) }}"
|
|
||||||
notify:
|
notify:
|
||||||
- Restart neutron services
|
- Restart neutron services
|
||||||
|
@ -20,8 +20,7 @@
|
|||||||
owner: "{{ neutron_system_user_name }}"
|
owner: "{{ neutron_system_user_name }}"
|
||||||
group: "{{ neutron_system_group_name }}"
|
group: "{{ neutron_system_group_name }}"
|
||||||
mode: "02755"
|
mode: "02755"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
|
|
||||||
- name: Create TEMP lock dir
|
- name: Create TEMP lock dir
|
||||||
file:
|
file:
|
||||||
@ -30,8 +29,7 @@
|
|||||||
owner: "{{ neutron_system_user_name }}"
|
owner: "{{ neutron_system_user_name }}"
|
||||||
group: "{{ neutron_system_group_name }}"
|
group: "{{ neutron_system_group_name }}"
|
||||||
mode: "02755"
|
mode: "02755"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
|
|
||||||
# TODO(mgariepy):
|
# TODO(mgariepy):
|
||||||
# Remove this in Pike as it only needed to handle upgrades
|
# Remove this in Pike as it only needed to handle upgrades
|
||||||
@ -40,8 +38,7 @@
|
|||||||
file:
|
file:
|
||||||
path: "/etc/tmpfiles.d/{{ item.value.service_name }}.conf"
|
path: "/etc/tmpfiles.d/{{ item.value.service_name }}.conf"
|
||||||
state: absent
|
state: absent
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
|
|
||||||
- name: Create tmpfiles.d entry
|
- name: Create tmpfiles.d entry
|
||||||
template:
|
template:
|
||||||
@ -50,8 +47,7 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
|
|
||||||
- name: Place the systemd init script
|
- name: Place the systemd init script
|
||||||
config_template:
|
config_template:
|
||||||
@ -62,7 +58,6 @@
|
|||||||
group: "root"
|
group: "root"
|
||||||
config_overrides: "{{ item.value.init_config_overrides }}"
|
config_overrides: "{{ item.value.init_config_overrides }}"
|
||||||
config_type: "ini"
|
config_type: "ini"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when: inventory_hostname in groups[item.value.group] | default([])
|
|
||||||
notify:
|
notify:
|
||||||
- Reload systemd daemon
|
- Reload systemd daemon
|
||||||
|
@ -85,14 +85,12 @@
|
|||||||
mode: "0640"
|
mode: "0640"
|
||||||
config_overrides: "{{ item.value.config_overrides }}"
|
config_overrides: "{{ item.value.config_overrides }}"
|
||||||
config_type: "{{ item.value.config_type }}"
|
config_type: "{{ item.value.config_type }}"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
notify:
|
notify:
|
||||||
- Restart neutron services
|
- Restart neutron services
|
||||||
when:
|
when:
|
||||||
- item.value.service_en | bool
|
|
||||||
- item.value.service_conf_path is defined
|
- item.value.service_conf_path is defined
|
||||||
- item.value.service_conf is defined
|
- item.value.service_conf is defined
|
||||||
- item.value.group in group_names
|
|
||||||
|
|
||||||
- name: Copy neutron rootwrap filters
|
- name: Copy neutron rootwrap filters
|
||||||
copy:
|
copy:
|
||||||
@ -111,9 +109,8 @@
|
|||||||
dest: "{{ neutron_conf_dir }}/{{ item.value.service_rootwrap }}"
|
dest: "{{ neutron_conf_dir }}/{{ item.value.service_rootwrap }}"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
with_dict: "{{ neutron_services }}"
|
with_dict: "{{ filtered_neutron_services }}"
|
||||||
when:
|
when:
|
||||||
- item.value.service_en | bool
|
|
||||||
- item.value.service_rootwrap is defined
|
- item.value.service_rootwrap is defined
|
||||||
notify:
|
notify:
|
||||||
- Restart neutron services
|
- Restart neutron services
|
||||||
|
Loading…
Reference in New Issue
Block a user