Fix bifrost automation tasks for Rocky

Changes to the openstack ansible modules and client SDKs have rendered our
authentication for ironic invalid. Bifrost now provides a working clouds.yaml,
so use this instead of the fudged endpoint/token setup in env-vars.

Also updates some use of the ironic client to the openstack client, and adds
support for the new 'inspect wait' ironic state to avoid surprises during
inspection.

Change-Id: I15ea388b6df8ced9cc0e0eceed8dec8aa8f57a9b
Story: 2001864
Task: 28078
This commit is contained in:
Mark Goddard 2018-11-26 11:10:25 +00:00
parent 8dc7ba7889
commit 411340b005
6 changed files with 38 additions and 39 deletions

View File

@ -67,9 +67,8 @@
- name: Set the overcloud nodes' maintenance mode
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
--connection local
@ -99,9 +98,8 @@
- name: Unset the overcloud nodes' maintenance mode
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
--connection local

View File

@ -34,9 +34,8 @@
- name: Check the ironic node's initial provision state
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export OS_BAREMETAL_API_VERSION=1.34 &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
@ -70,7 +69,8 @@
- name: Ensure the ironic node is deprovisioned
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal -vvvv
--connection local
@ -79,7 +79,7 @@
-e @/etc/bifrost/dib.yml
--limit {{ inventory_hostname }}
-m command
-a "ironic node-set-provision-state {% raw %}{{ inventory_hostname }}{% endraw %} deleted"'
-a "openstack baremetal node undeploy {% raw %}{{ inventory_hostname }}{% endraw %}"'
register: delete_result
until: delete_result | success or 'is locked by host' in delete_result.stdout
retries: "{{ ironic_retries }}"
@ -94,9 +94,8 @@
- name: Wait for the ironic node to become available
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export OS_BAREMETAL_API_VERSION=1.34 &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal

View File

@ -19,6 +19,7 @@
# List of valid states while a node is being inspected.
inspecting_states:
- inspecting
- inspect wait
# Retries to use when using Ironic API and hitting node locked errors.
ironic_retries: 6
ironic_retry_interval: 5
@ -28,9 +29,8 @@
- name: Check the ironic node's initial provision state
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
--connection local
@ -63,7 +63,8 @@
- name: Ensure the ironic node is manageable
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal -vvvv
--connection local
@ -72,7 +73,7 @@
-e @/etc/bifrost/dib.yml
--limit {{ inventory_hostname }}
-m command
-a "ironic node-set-provision-state {% raw %}{{ inventory_hostname }}{% endraw %} manage"'
-a "openstack baremetal node manage {% raw %}{{ inventory_hostname }}{% endraw %}"'
register: manage_result
until: manage_result | success or 'is locked by host' in manage_result.stdout
retries: "{{ ironic_retries }}"
@ -87,7 +88,8 @@
- name: Ensure the ironic node is inspected
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal -vvvv
--connection local
@ -96,7 +98,7 @@
-e @/etc/bifrost/dib.yml
--limit {{ inventory_hostname }}
-m command
-a "ironic node-set-provision-state {% raw %}{{ inventory_hostname }}{% endraw %} inspect"'
-a "openstack baremetal node inspect {% raw %}{{ inventory_hostname }}{% endraw %}"'
register: provide_result
until: provide_result | success or 'is locked by host' in provide_result.stdout
retries: "{{ ironic_retries }}"
@ -110,9 +112,8 @@
- name: Wait for the ironic node to be inspected
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
--connection local

View File

@ -12,9 +12,8 @@
- name: Query overcloud nodes' hardware introspection data
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_TOKEN=fake-token &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
--connection local

View File

@ -10,7 +10,8 @@
- name: Gather the Ironic node inventory using Bifrost
command: >
docker exec bifrost_deploy
bash -c 'source /bifrost/env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
/bifrost/playbooks/inventory/bifrost_inventory.py'
register: inventory_result

View File

@ -37,9 +37,8 @@
- name: Check the ironic node's initial provision state
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export OS_BAREMETAL_API_VERSION=1.34 &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal
@ -73,7 +72,8 @@
- name: Ensure the ironic node is manageable
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal -vvvv
--connection local
@ -82,7 +82,7 @@
-e @/etc/bifrost/dib.yml
--limit {{ inventory_hostname }}
-m command
-a "ironic node-set-provision-state {% raw %}{{ inventory_hostname }}{% endraw %} manage"'
-a "openstack baremetal node manage {% raw %}{{ inventory_hostname }}{% endraw %}"'
register: manage_result
until: manage_result | success or 'is locked by host' in manage_result.stdout
retries: "{{ ironic_retries }}"
@ -97,7 +97,8 @@
- name: Ensure the ironic node is available
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal -vvvv
--connection local
@ -106,7 +107,7 @@
-e @/etc/bifrost/dib.yml
--limit {{ inventory_hostname }}
-m command
-a "ironic node-set-provision-state {% raw %}{{ inventory_hostname }}{% endraw %} provide"'
-a "openstack baremetal node provide {% raw %}{{ inventory_hostname }}{% endraw %}"'
register: provide_result
until: provide_result | success or 'is locked by host' in provide_result.stdout
retries: "{{ ironic_retries }}"
@ -128,7 +129,8 @@
- name: Ensure the ironic nodes are provisioned
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
bash -c '
export OS_CLOUD=bifrost &&
export BIFROST_INVENTORY_SOURCE=ironic &&
export OS_BAREMETAL_API_VERSION=1.34 &&
ansible-playbook -vvvv
@ -150,9 +152,8 @@
- name: Wait for the ironic node to become active
command: >
docker exec bifrost_deploy
bash -c '. env-vars &&
export OS_URL=$IRONIC_URL &&
export OS_TOKEN=$OS_AUTH_TOKEN &&
bash -c '
export OS_CLOUD=bifrost &&
export OS_BAREMETAL_API_VERSION=1.34 &&
export BIFROST_INVENTORY_SOURCE=ironic &&
ansible baremetal