tripleo-heat-templates/common/deploy-steps-playbooks-common.yaml
James Slagle de668b4ec2 Use FQCN for ansible builtin tasks
Using the FQCN for ansible builtin tasks is required by the new
ansible-lint 6.0.0. Otherwise, the pep8 job fails running ansible-lint.

Closes-Bug: #1964935

Change-Id: I82f65a39856bc86cbdb58de969f0392ea36c4e04
Signed-off-by: James Slagle <jslagle@redhat.com>
2022-03-15 08:10:17 -04:00

104 lines
3.4 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: localhost
name: Check if required variables are defined
tasks:
- ansible.builtin.fail:
msg: deploy_source_host variable is not defined
when: deploy_source_host is not defined
- ansible.builtin.fail:
msg: deploy_target_host variable is not defined
when: deploy_target_host is not defined
# Keep in mind that you will still need to use defaults in order to be
# able to pass Ansible own syntax check for blocks like 'hosts'.
- hosts: all
name: Clear cached facts
# We don't want to gather facts, just clear them
gather_facts: false
tasks:
- ansible.builtin.meta: clear_facts
tags:
- facts
- hosts: "{{ deploy_source_host | default([]) }}:{{ deploy_target_host | default([]) }}"
name: Gather facts
strategy: tripleo_free
gather_facts: true
tasks:
- name: Set legacy facts
ansible.builtin.set_fact:
ansible_distribution: "{{ ansible_facts['distribution'] }}"
ansible_distribution_major_version: "{{ ansible_facts['distribution_major_version'] }}"
ansible_distribution_release: "{{ ansible_facts['distribution_release'] }}"
ansible_distribution_version: "{{ ansible_facts['distribution_version'] }}"
ansible_os_family: "{{ ansible_facts['os_family'] }}"
tags:
- facts
- hosts: all
name: Load global variables
gather_facts: "{{ gather_facts | default(false) }}"
any_errors_fatal: false
ignore_unreachable: true
tasks:
- ansible.builtin.include_vars: global_vars.yaml # noqa: missing-import
no_log: true
tags:
- always
- hosts: all
name: Include extra variables from files
gather_facts: "{{ gather_facts | default(false) }}"
any_errors_fatal: false
ignore_unreachable: true
tasks:
- name: Include Service VIP vars
ansible.builtin.include_vars:
file: "{{ playbook_dir }}/service_vip_vars.yaml"
name: service_vip_vars
ignore_errors: true
- name: Include OVN bridge MAC address variables
ansible.builtin.include_vars:
file: "{{ playbook_dir }}/ovn_bridge_mac_address_vars.yaml"
name: ovn_bridge_mac_address_vars
ignore_errors: true
tags:
- always
- hosts: "{{ deploy_target_host | default([]) }}"
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 | default([]) }}"
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
ansible.builtin.include_vars: "{{ playbook_dir }}/group_vars/overcloud.json"
no_log: true
when: not ansible_check_mode|bool
tags:
- facts
- always