Force Ansible to use dynamic includes

Ansible 2.1.1 introduces a regression in the way conditional
includes are handled which results in every task in the
included file being evaluated even if the condition for the
include is not met. This extends the run time significantly
for a deployment.

This patch forces all conditional includes to be dynamic.

Change-Id: Ia4c26126a7c1fc2728252eacf71870b7bfb5b6a5
Related-Bug: https://github.com/ansible/ansible/issues/17687
This commit is contained in:
Jesse Pretorius 2016-09-22 14:08:35 +01:00
parent 4cb21da177
commit 7872b49691
9 changed files with 67 additions and 53 deletions

View File

@ -14,11 +14,10 @@
# limitations under the License.
- include: keystone_credential_create.yml
when: >
inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_credential_distribute.yml
when: >
inventory_hostname == groups['keystone_all'][0]
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_credential_autorotate.yml

View File

@ -14,11 +14,11 @@
# limitations under the License.
- include: keystone_fernet_keys_create.yml
when: >
inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_fernet_keys_distribute.yml
when: >
inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_fernet_keys_autorotate.yml

View File

@ -14,19 +14,19 @@
# limitations under the License.
- include: keystone_idp_self_signed_create.yml
when:
- inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_idp_self_signed_store.yml
when:
- inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_idp_self_signed_distribute.yml
when:
- inventory_hostname != groups['keystone_all'][0]
static: no
when: inventory_hostname != groups['keystone_all'][0]
- include: keystone_idp_metadata.yml
- include: keystone_idp_sp_setup.yml
when:
- keystone_service_setup | bool
static: no
when: keystone_service_setup | bool

View File

@ -14,9 +14,11 @@
# limitations under the License.
- include: keystone_init_upstart.yml
static: no
when: pid1_name == "init"
- include: keystone_init_systemd.yml
static: no
when: pid1_name == "systemd"
- name: Load service

View File

@ -14,12 +14,12 @@
# limitations under the License.
- include: keystone_install_apt.yml
when:
- ansible_pkg_mgr == 'apt'
static: no
when: ansible_pkg_mgr == 'apt'
- include: keystone_install_yum.yml
when:
- ansible_pkg_mgr == 'yum'
static: no
when: ansible_pkg_mgr == 'yum'
- name: Create WSGI symlinks
file:

View File

@ -14,8 +14,9 @@
# limitations under the License.
- include: keystone_ssl_self_signed.yml
when: >
keystone_ssl | bool and
(keystone_user_ssl_cert is not defined or keystone_user_ssl_key is not defined)
static: no
when:
- keystone_ssl | bool
- keystone_user_ssl_cert is not defined or keystone_user_ssl_key is not defined
- include: keystone_ssl_user_provided.yml

View File

@ -14,13 +14,13 @@
# limitations under the License.
- include: keystone_ssl_key_create.yml
when: >
inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_ssl_key_store.yml
when: >
inventory_hostname == groups['keystone_all'][0]
static: no
when: inventory_hostname == groups['keystone_all'][0]
- include: keystone_ssl_key_distribute.yml
when: >
inventory_hostname != groups['keystone_all'][0]
static: no
when: inventory_hostname != groups['keystone_all'][0]

View File

@ -72,38 +72,41 @@
- keystone-install
- include: keystone_fernet.yml
tags:
- keystone-install
- keystone-config
static: no
when:
- "'fernet' in keystone_token_provider"
- keystone_service_setup | bool
tags:
- keystone-install
- keystone-config
- include: keystone_credential.yml
when:
- keystone_service_setup | bool
static: no
when: keystone_service_setup | bool
tags:
- keystone-install
- include: keystone_federation_sp_setup.yml
static: no
when: keystone_sp != {}
tags:
- keystone-install
- keystone-config
when:
- keystone_sp != {}
- include: keystone_db_setup.yml
tags:
- keystone-install
static: no
when:
- keystone_database_enabled | bool
- inventory_hostname == groups['keystone_all'][0]
- include: keystone_token_cleanup.yml
tags:
- keystone-install
- include: keystone_token_cleanup.yml
static: no
when:
- "'sql' in keystone_token_driver"
tags:
- keystone-install
- include: keystone_ssl.yml
tags:
@ -111,56 +114,61 @@
- keystone-config
- include: keystone_apache.yml
static: no
when: keystone_apache_enabled | bool
tags:
- keystone-install
- keystone-config
when: keystone_apache_enabled | bool
- include: keystone_nginx.yml
static: no
when: not keystone_apache_enabled | bool
tags:
- keystone-install
- keystone-config
when: not keystone_apache_enabled | bool
- include: keystone_uwsgi.yml
static: no
when: not keystone_mod_wsgi_enabled | bool
tags:
- keystone-install
- keystone-config
when: not keystone_mod_wsgi_enabled | bool
- name: Flush handlers
meta: flush_handlers
- include: keystone_service_setup.yml
tags:
- keystone-install
- keystone-config
static: no
when:
- keystone_service_setup | bool
- inventory_hostname == groups['keystone_all'][0]
tags:
- keystone-install
- keystone-config
- include: keystone_ldap_setup.yml
when:
- keystone_service_setup | bool
static: no
when: keystone_service_setup | bool
tags:
- keystone-install
- keystone-config
- include: keystone_federation_sp_idp_setup.yml
tags:
- keystone-install
- keystone-config
static: no
when:
- keystone_service_setup | bool
- keystone_sp != {}
- inventory_hostname == groups['keystone_all'][0]
tags:
- keystone-install
- keystone-config
- name: Flush handlers
meta: flush_handlers
- include: keystone_idp_setup.yml
static: no
when: keystone_idp != {}
tags:
- keystone-install
- keystone-config
when:
- keystone_idp != {}

View File

@ -10,6 +10,10 @@
src: https://git.openstack.org/openstack/openstack-ansible-memcached_server
scm: git
version: master
- name: openstack_hosts
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
scm: git
version: master
- name: lxc_hosts
src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
scm: git