Update admin auth playbook to make stack optional

This change will make the tripleo_cloud_name variable optional.
This will allow us to use this playbook more broadly.

Change-Id: Idff1a14c5ce785a6d0aa9d71e1e91e859f966634
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-10-29 17:01:51 -05:00 committed by Kevin Carter
parent 3865b014b7
commit 6d55996f92
1 changed files with 22 additions and 23 deletions

View File

@ -19,6 +19,8 @@
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
any_errors_fatal: true
vars:
BlacklistedIpAddresses: []
handlers:
- name: Remove mistral tmp file
file:
@ -32,13 +34,10 @@
when:
- ssh_servers is undefined
- name: No cloud name is defined
fail:
msg: >-
The tripleo_cloud_name option was undefined.
- name: Cloud name block
when:
- tripleo_cloud_name is undefined
- tripleo_cloud_name is defined
block:
- name: Run blacklist IP check
command: >-
openstack --os-cloud undercloud stack output show {{ tripleo_cloud_name }} BlacklistedIpAddresses -f yaml
@ -47,6 +46,17 @@
async: 1000
poll: 0
- name: Block on async blacklist check
async_status:
jid: "{{ blacklist_cmd.ansible_job_id }}"
register: blacklist_cmd_job_result
until: blacklist_cmd_job_result.finished
retries: 30
- name: Set BlacklistedIpAddresses fact
set_fact:
BlacklistedIpAddresses: "{{ (blacklist_cmd_job_result.stdout | from_yaml)['output_value'] }}"
- name: Retrieve compute managed network ports
os_port_facts:
cloud: undercloud
@ -162,17 +172,6 @@
key: "{{ user_public_key }}"
become: true
- name: Block on async blacklist check
async_status:
jid: "{{ blacklist_cmd.ansible_job_id }}"
register: blacklist_cmd_job_result
until: blacklist_cmd_job_result.finished
retries: 30
- name: Set BlacklistedIpAddresses fact
set_fact:
BlacklistedIpAddresses: "{{ (blacklist_cmd_job_result.stdout | from_yaml)['output_value'] }}"
- name: Block on async port check
async_status:
jid: "{{ port_check.ansible_job_id }}"