Use run_once instead of inventory scoping
By using run_once we avoid skipped tasks and instead the tasks are filtered way earlier. For situations where we absolutely need to execute something on a particular host, we delegate to that host instead. This works better when using limits and is more efficient. Change-Id: Id2034562b3e26da56c36dd88badddf1a3b623e20
This commit is contained in:
parent
b0b644efa3
commit
2076de5b49
@ -15,9 +15,12 @@
|
|||||||
|
|
||||||
- name: Check current state of Keystone DB
|
- name: Check current state of Keystone DB
|
||||||
command: "{{ keystone_bin }}/keystone-manage db_sync --check"
|
command: "{{ keystone_bin }}/keystone-manage db_sync --check"
|
||||||
|
become: yes
|
||||||
|
become_user: "{{ keystone_system_user_name }}"
|
||||||
register: keystone_db_sync_check
|
register: keystone_db_sync_check
|
||||||
failed_when: "keystone_db_sync_check.rc == 1"
|
failed_when: "keystone_db_sync_check.rc == 1"
|
||||||
changed_when: "keystone_db_sync_check.rc not in [2, 3, 4]"
|
changed_when: "keystone_db_sync_check.rc not in [2, 3, 4]"
|
||||||
|
run_once: yes
|
||||||
|
|
||||||
- name: Set the db sync local facts
|
- name: Set the db sync local facts
|
||||||
ini_file:
|
ini_file:
|
||||||
@ -63,6 +66,7 @@
|
|||||||
become_user: "{{ keystone_system_user_name }}"
|
become_user: "{{ keystone_system_user_name }}"
|
||||||
when:
|
when:
|
||||||
- "ansible_local['openstack_ansible']['keystone']['need_db_expand'] | bool"
|
- "ansible_local['openstack_ansible']['keystone']['need_db_expand'] | bool"
|
||||||
|
run_once: yes
|
||||||
|
|
||||||
- name: Perform a Keystone DB sync migrate
|
- name: Perform a Keystone DB sync migrate
|
||||||
command: "{{ keystone_bin }}/keystone-manage db_sync --migrate"
|
command: "{{ keystone_bin }}/keystone-manage db_sync --migrate"
|
||||||
@ -70,6 +74,7 @@
|
|||||||
become_user: "{{ keystone_system_user_name }}"
|
become_user: "{{ keystone_system_user_name }}"
|
||||||
when:
|
when:
|
||||||
- "ansible_local['openstack_ansible']['keystone']['need_db_migrate'] | bool"
|
- "ansible_local['openstack_ansible']['keystone']['need_db_migrate'] | bool"
|
||||||
|
run_once: yes
|
||||||
|
|
||||||
- name: Perform a Keystone DB sync contract
|
- name: Perform a Keystone DB sync contract
|
||||||
command: "{{ keystone_bin }}/keystone-manage db_sync --contract"
|
command: "{{ keystone_bin }}/keystone-manage db_sync --contract"
|
||||||
@ -78,3 +83,4 @@
|
|||||||
when:
|
when:
|
||||||
- "(keystone_all_software_updated | default('no')) | bool"
|
- "(keystone_all_software_updated | default('no')) | bool"
|
||||||
- "ansible_local['openstack_ansible']['keystone']['need_db_contract'] | bool"
|
- "ansible_local['openstack_ansible']['keystone']['need_db_contract'] | bool"
|
||||||
|
run_once: yes
|
||||||
|
@ -19,3 +19,4 @@
|
|||||||
minute: 0
|
minute: 0
|
||||||
job: "{{ keystone_bin }}/keystone-manage token_flush"
|
job: "{{ keystone_bin }}/keystone-manage token_flush"
|
||||||
user: "{{ keystone_system_user_name }}"
|
user: "{{ keystone_system_user_name }}"
|
||||||
|
delegate_to: "{{ groups['keystone_all'][0] }}"
|
||||||
|
@ -95,7 +95,6 @@
|
|||||||
- include: keystone_db_setup.yml
|
- include: keystone_db_setup.yml
|
||||||
when:
|
when:
|
||||||
- "keystone_database_enabled | bool"
|
- "keystone_database_enabled | bool"
|
||||||
- "inventory_hostname == ansible_play_hosts[0]"
|
|
||||||
tags:
|
tags:
|
||||||
- keystone-config
|
- keystone-config
|
||||||
|
|
||||||
@ -103,7 +102,7 @@
|
|||||||
static: no
|
static: no
|
||||||
when:
|
when:
|
||||||
- "'sql' in keystone_token_driver"
|
- "'sql' in keystone_token_driver"
|
||||||
- inventory_hostname == groups['keystone_all'][0]
|
run_once: yes
|
||||||
tags:
|
tags:
|
||||||
- keystone-install
|
- keystone-install
|
||||||
|
|
||||||
@ -127,7 +126,7 @@
|
|||||||
- include: keystone_service_setup.yml
|
- include: keystone_service_setup.yml
|
||||||
when:
|
when:
|
||||||
- keystone_service_setup | bool
|
- keystone_service_setup | bool
|
||||||
- inventory_hostname == ansible_play_hosts[0]
|
run_once: yes
|
||||||
tags:
|
tags:
|
||||||
- keystone-config
|
- keystone-config
|
||||||
|
|
||||||
@ -141,7 +140,7 @@
|
|||||||
when:
|
when:
|
||||||
- keystone_service_setup | bool
|
- keystone_service_setup | bool
|
||||||
- keystone_sp != {}
|
- keystone_sp != {}
|
||||||
- inventory_hostname == groups['keystone_all'][0]
|
run_once: yes
|
||||||
tags:
|
tags:
|
||||||
- keystone-config
|
- keystone-config
|
||||||
|
|
||||||
@ -161,5 +160,6 @@
|
|||||||
register: keystone_doctor
|
register: keystone_doctor
|
||||||
failed_when: not debug and keystone_doctor.rc != 0
|
failed_when: not debug and keystone_doctor.rc != 0
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
run_once: yes
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
Loading…
x
Reference in New Issue
Block a user