411340b005
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
57 lines
2.2 KiB
YAML
57 lines
2.2 KiB
YAML
---
|
|
# Gather an inventory of nodes from the seed's Ironic service. Use this to
|
|
# generate an Ansible inventory for Kayobe.
|
|
|
|
- name: Ensure the overcloud Ansible inventory is populated
|
|
hosts: seed
|
|
tags:
|
|
- inventory-discover
|
|
tasks:
|
|
- name: Gather the Ironic node inventory using Bifrost
|
|
command: >
|
|
docker exec bifrost_deploy
|
|
bash -c '
|
|
export OS_CLOUD=bifrost &&
|
|
export BIFROST_INVENTORY_SOURCE=ironic &&
|
|
/bifrost/playbooks/inventory/bifrost_inventory.py'
|
|
register: inventory_result
|
|
changed_when: False
|
|
|
|
- name: Set a fact containing the Ironic node inventory
|
|
set_fact:
|
|
ironic_inventory: "{{ inventory_result.stdout | from_json }}"
|
|
|
|
- name: Ensure Kayobe overcloud inventory exists
|
|
local_action:
|
|
module: copy
|
|
content: |
|
|
# Managed by Ansible - do not edit.
|
|
# This is the Kayobe overcloud inventory, autogenerated from the seed
|
|
# node's Ironic inventory.
|
|
|
|
{# Build a list of all hosts with explicit mappings. #}
|
|
{% set all_mapped_hosts = [] %}
|
|
{% for hosts in overcloud_group_hosts_map.values() %}
|
|
{% set _ = all_mapped_hosts.extend(hosts) %}
|
|
{% endfor %}
|
|
{% set ignore_hosts = overcloud_group_hosts_map.get("ignore", []) %}
|
|
|
|
{# Add a section for each group. #}
|
|
{% for group in overcloud_groups %}
|
|
[{{ group }}]
|
|
{% set group_hosts = overcloud_group_hosts_map.get(group, []) %}
|
|
{% for host in ironic_inventory.baremetal.hosts %}
|
|
{% if (host in group_hosts or
|
|
(group == overcloud_group_default and host not in all_mapped_hosts))
|
|
and host not in ignore_hosts %}
|
|
{% set hostvars=ironic_inventory._meta.hostvars[host] %}
|
|
{% set ipmi_address=hostvars.driver_info.ipmi_address | default %}
|
|
{% set system_vendor=hostvars.extra.system_vendor | default %}
|
|
{% set bmc_type=system_vendor | bmc_type_from_system_vendor %}
|
|
{{ host }} ipmi_address={{ ipmi_address }} bmc_type={{ bmc_type }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
dest: "{{ kayobe_config_path }}/inventory/overcloud"
|