tripleo-heat-templates/common/deploy-steps-playbooks-common.yaml
Bogdan Dobrelya d9ed99b5d9 Clear cached facts based on the tag as well
Facts gathering comes next after clearing the cached ones. Facts
will be gathered if --tags facts was specified. But cached facts get
cleared always, even w/o that tag.

In DCN deployments that may bring errors that can be avoided with
ansible-playbook-command.sh --tags facts. That is because fact caching
needs to be updated when running outside of the overcloud.

Fix this inconsistency so that the facts never cleared nor gathered
until the facts tag has been used explicitly.

Change-Id: I0ef544a18ec868321ebf51a99051b1ed982cd677
Related-bug: #1896620
Related-bug: #1884654
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
2020-09-23 09:23:01 +02:00

69 lines
2.0 KiB
YAML

---
# If a new play with potential facts gathering is added, make sure we set:
# any_errors_fatal: false
# ignore_unreachable: true
# So we don't break the MaxFailPercentage feature since these plays can't use
# Ansible strategies.
- hosts: all
name: Clear cached facts
tasks:
- meta: clear_facts
tags:
- facts
- hosts: "{{ deploy_source_host }}:{{ deploy_target_host }}"
name: Gather facts
gather_facts: yes
# False because https://github.com/ansible/ansible/issues/70663
any_errors_fatal: false
# If an overcloud node is down, we will let MaxFailPercentage
# figuring out if the deployment can continue. For the facts gathering tasks,
# we will simply ignore unreachable nodes and errors, and let the
# Ansible reports the failure in the next plays.
ignore_unreachable: true
tags:
- facts
- hosts: all
name: Load global variables
gather_facts: "{{ gather_facts | default(false) }}"
any_errors_fatal: false
ignore_unreachable: true
tasks:
- include_vars: global_vars.yaml
no_log: true
tags:
- always
- hosts: "{{ deploy_target_host }}"
name: Render all_nodes data as group_vars for overcloud
gather_facts: "{{ gather_facts | default(false) }}"
# we don't skip errors or ignore unreachable on this one because it's
# delegated to localhost. localhost should never be unreachable (tm)
any_errors_fatal: True
tasks:
- name: Render all_nodes data as group_vars for overcloud
delegate_to: localhost
become: false
run_once: true
when: not ansible_check_mode|bool
tripleo_all_nodes_data:
tags:
- facts
- always
- hosts: "{{ deploy_target_host }}"
name: Set all_nodes data as group_vars for overcloud
gather_facts: "{{ gather_facts | default(false) }}"
any_errors_fatal: false
ignore_unreachable: true
tasks:
- name: Set all_nodes data as group_vars for overcloud
include_vars: "{{ playbook_dir }}/group_vars/overcloud.json"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
- always