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

View File

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

View File

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

View File

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

View File

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

View File

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