Merge "Define condition for the first play host one time"

This commit is contained in:
Zuul 2020-09-21 08:49:44 +00:00 committed by Gerrit Code Review
commit 6dd71d2b0e
3 changed files with 8 additions and 13 deletions

View File

@ -84,7 +84,7 @@
flat: yes
changed_when: false
with_items: "{{ cinder_core_files }}"
run_once: true
when: _cinder_is_first_play_host
- name: Copy common config
config_template:

View File

@ -42,8 +42,7 @@
- import_tasks: db_setup.yml
when:
- "cinder_services['cinder-api']['group'] in group_names"
- "inventory_hostname == ((groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | list)[0]"
- _cinder_is_first_play_host
vars:
_oslodb_setup_host: "{{ cinder_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ cinder_db_setup_python_interpreter }}"
@ -60,8 +59,7 @@
- import_tasks: mq_setup.yml
when:
- "cinder_services['cinder-api']['group'] in group_names"
- "inventory_hostname == ((groups[cinder_services['cinder-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
- _cinder_is_first_play_host
vars:
_oslomsg_rpc_setup_host: "{{ cinder_oslomsg_rpc_setup_host }}"
_oslomsg_rpc_userid: "{{ cinder_oslomsg_rpc_userid }}"
@ -132,9 +130,7 @@
- import_tasks: cinder_db_sync.yml
when:
- "groups['cinder_api'] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"
- "inventory_hostname == ((groups['cinder_api'] | intersect(ansible_play_hosts)) | list)[0]"
- _cinder_is_first_play_host
tags:
- cinder-config
@ -163,9 +159,7 @@
password: "{{ cinder_service_password }}"
role: "{{ cinder_service_role_name }}"
when:
- "groups['cinder_api'] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"
- "inventory_hostname == ((groups['cinder_api'] | intersect(ansible_play_hosts)) | list)[0]"
- "_cinder_is_first_play_host"
tags:
- cinder-config
@ -203,7 +197,6 @@
- import_tasks: cinder_backends.yml
when:
- "groups[cinder_services['cinder-volume']['group']] | length > 0"
- "cinder_services['cinder-api']['group'] in group_names"
- "inventory_hostname == ((groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | list)[-1]"
- "_cinder_is_first_play_host"
tags:
- cinder-config

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_cinder_is_first_play_host: "{{ (cinder_services['cinder-api']['group'] in group_names and inventory_hostname == (groups[cinder_services['cinder-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}"
_cinder_rootwrap_conf_overrides:
DEFAULT:
filters_path: "/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap"