Use cachable facts to allow multiple runs

* add "cachable: true" to set_fact calls when the fact would be used by
  other roles in later runs; the other fact names were checked to make
  sure they are not referred to in other roles
* consolidate the formatting of the set_fact calls, using the proper
  yaml structure instead of `set_fact: foo=bar`

Depends-On: I987d51cc252b7ebc3972d60497234fa676864882
Change-Id: I5dd3084ead618e357b1e7d841ea2ee794bd0569a
This commit is contained in:
Attila Darazs 2017-12-05 16:52:30 +01:00
parent d63ef20cc3
commit 689d759e64
9 changed files with 27 additions and 11 deletions

View File

@ -36,14 +36,16 @@
- name: Default to using cached images
set_fact:
to_build: false
cacheable: true
- name: Build images when we have a change in the always build list
set_fact:
to_build: true
cacheable: true
when: projects_need_build != []
- name: Always build images in the periodic jobs
set_fact:
to_build: true
cacheable: true
when: "{{ lookup('env', 'PERIODIC')|default('0')|int == 1 }}"

View File

@ -65,7 +65,8 @@
rescue:
- name: Set image_build_failed fact
set_fact: image_build_failed=true
set_fact:
image_build_failed: true
always:
- name: Displaying log files from build isolation image

View File

@ -1,6 +1,7 @@
---
- name: Set release name
set_fact: artg_release={{ artg_change.branch | replace('stable/', '') }}
set_fact:
artg_release: "{{ artg_change.branch | replace('stable/', '') }}"
- name: Set DLRN distro (legacy distgit branch naming)
set_fact:

View File

@ -103,6 +103,7 @@
gerrit_host: "{{ lookup('env', 'GERRIT_HOST') }}"
zuul_changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
artg_change_list: "{{ artg_change_list|default([]) }}"
cacheable: true
- name: Parse Jenkins changes
jenkins_deps:
@ -115,6 +116,7 @@
- name: Add Jenkins changes to the change list
set_fact:
artg_change_list: "{{ artg_change_list|union(jenkins_change_list|default([])) }}"
cacheable: true
- name: Parse Zuul changes
zuul_deps:
@ -126,6 +128,7 @@
- name: Add Zuul changes to the change list
set_fact:
artg_change_list: "{{ artg_change_list|union(zuul_change_list|default([])) }}"
cacheable: true
- name: Clone and build the specific DLRN projects
include: dlrn-build.yml artg_change={{ item }}
@ -174,7 +177,9 @@
- dlrn_cleanup|bool
- name: Trigger repo injection for quickstart
set_fact: compressed_gating_repo={{ artg_compressed_gating_repo }}
set_fact:
compressed_gating_repo: "{{ artg_compressed_gating_repo }}"
cacheable: true
when:
- repo_built is defined
- repo_built.skipped is not defined

View File

@ -4,11 +4,13 @@
- name: Set FreeIPA admin password
set_fact:
freeipa_admin_password: "{{ lookup('pipe','uuidgen') }}"
cacheable: true
when: freeipa_admin_password is not defined
- name: Set directory manager password
set_fact:
directory_manager_password: "{{ lookup('pipe','uuidgen') }}"
cacheable: true
when: directory_manager_password is not defined
- name: Create FreeIPA deployment script

View File

@ -21,10 +21,11 @@
- name: generate prefix for all run-related entities
set_fact:
prefix="{{ tmp.node_prefix }}"
prefix: "{{ tmp.node_prefix }}"
- name: set fact for undercloud image
set_fact: latest_undercloud_image="{{ latest_guest_image[osp_release | default(release)] }}"
set_fact:
latest_undercloud_image: "{{ latest_guest_image[osp_release | default(release)] }}"
- name: copy key inserted in image to undercloud_key location
copy:
@ -110,7 +111,8 @@
- name: Set fact for undercloud floating IP address
set_fact:
undercloud_ip="{{ (stack_outputs.stdout|from_json).outputs[0].output_value }}"
undercloud_ip: "{{ (stack_outputs.stdout|from_json).outputs[0].output_value }}"
cacheable: true
- name: Add provisioned undercloud host
add_host:

View File

@ -92,7 +92,8 @@
when: use_resource_registry_nic_configs|bool
- name: extract the number of controllers to be deployed
set_fact: number_of_controllers="{{ deploy_args| regex_replace('^.*--control-scale +([0-9]+).*$', '\\1') | regex_replace('^[^ 0-9]+$', '1') }}"
set_fact:
number_of_controllers: "{{ deploy_args| regex_replace('^.*--control-scale +([0-9]+).*$', '\\1') | regex_replace('^[^ 0-9]+$', '1') }}"
- name: Set cinder-backup
set_fact:
@ -169,7 +170,8 @@
- set_overcloud_workers|bool
- name: Use KVM for Red Hat distro
set_fact: libvirt_args="--libvirt-type kvm"
set_fact:
libvirt_args: "--libvirt-type kvm"
when:
- ansible_distribution is defined
- ansible_distribution == 'RedHat'

View File

@ -8,7 +8,8 @@
when: enable_pacemaker|bool
- name: extract the number of controllers to be deployed
set_fact: number_of_controllers="{{ scale_args| regex_replace('^.*--control-scale +([0-9]+).*$', '\\1') | regex_replace('^[^ 0-9]+$', '1') }}"
set_fact:
number_of_controllers: "{{ scale_args| regex_replace('^.*--control-scale +([0-9]+).*$', '\\1') | regex_replace('^[^ 0-9]+$', '1') }}"
- name: disable L3 HA
set_fact:

View File

@ -44,7 +44,7 @@
- name: set the number of workers for heat engine before runnning OC upgrade
when: set_heat_workers
set_fact:
heat_workers="{{ core.stdout|int / 2 }}"
heat_workers: "{{ core.stdout|int / 2 }}"
# Hardcode the number of heat workers, to try to avoid the badstatusline in
# centos ci: