From cb640cbe1d29a2c59d72f25ec590811edfff26d3 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 11 May 2017 16:19:08 +0200 Subject: [PATCH] Use dynamic include for conditional/tagged tasks Ansible 2.1 tries to predict static/dynamic cases for include. It sometimes fails to do so for tagged or conditional include commands. This makes all included tags/tasks to be played, but skipped anyway, even though it was asked to be omitted. Help ansible to predict dynamic cases by explicit 'static: no' directives put for 'when:/tags:' include commands. This speeds up deployment a lot. Change-Id: I3daf21e45223c5165abee74e92e1395dee5f6fe9 Signed-off-by: Bogdan Dobrelya --- roles/libvirt/setup/undercloud/tasks/main.yml | 5 +++++ roles/tripleo-inventory/tests/playbooks/quickstart-usb.yml | 1 + 2 files changed, 6 insertions(+) diff --git a/roles/libvirt/setup/undercloud/tasks/main.yml b/roles/libvirt/setup/undercloud/tasks/main.yml index 8c41f3504..4b533a04b 100644 --- a/roles/libvirt/setup/undercloud/tasks/main.yml +++ b/roles/libvirt/setup/undercloud/tasks/main.yml @@ -38,20 +38,24 @@ # Conditionally include a playbook for all the images specified # in options that updates images to the latest delorean version - include: inject_repos.yml + static: no when: devmode|bool # inject the gating repo generated by ansible-role-tripleo-gate - include: inject_gating_repo.yml + static: no when: compressed_gating_repo is defined # Converts an overcloud-full.qcow2 into a undercloud.qcow2 - include: convert_image.yml + static: no when: overcloud_as_undercloud|bool or baseos_as_undercloud|bool # Update images after we have converted the overcloud-full to an # undercloud image when using devmode. This also clones tripleo-ci # on the undercloud image. - include: update_image.yml + static: no when: devmode|bool # Inject updated overcloud and ipa images into our converted undercloud @@ -147,6 +151,7 @@ # overcloud image, to cover any extra needs. - name: Perform extra overcloud customizations include: customize_overcloud.yml + static: no when: overcloud_customize_script is defined # Perform an SELinux relabel on the undercloud image to avoid problems diff --git a/roles/tripleo-inventory/tests/playbooks/quickstart-usb.yml b/roles/tripleo-inventory/tests/playbooks/quickstart-usb.yml index c05afb064..8a2ff2c17 100644 --- a/roles/tripleo-inventory/tests/playbooks/quickstart-usb.yml +++ b/roles/tripleo-inventory/tests/playbooks/quickstart-usb.yml @@ -4,6 +4,7 @@ # creating an inventory entry for our `virthost` and for creating an # unprivileged user on that host for use by our virtual environment. - include: provision.yml + static: no tags: - provision