I’m using the os_client_config
openstack module. this is the piece of code where I’m using which comes from OpenStack tenks.
- name: Set ironic_url for os_ironic module
when: lookup('env', 'OS_CLOUD') | length > 0
block:
- name: Query clouds.yaml
os_client_config:
clouds: "{{ lookup('env', 'OS_CLOUD') }}"
delegate_to: localhost
vars:
ansible_python_interpreter: >-
{{ lookup('env', 'VIRTUAL_ENV') | default('/usr', true) ~ '/bin/python' }}
- name: Fail if the cloud was not found
fail:
msg: >
Cloud {{ lookup('env', 'OS_CLOUD') }} was not found in clouds.yaml
when: >-
openstack.clouds | length == 0 or
not openstack.clouds[0].get('auth', {}).get('endpoint')
- name: Set a fact about the ironic API endpoint
set_fact:
ironic_url: "{{ openstack.clouds[0].auth.endpoint }}"
I’ve debug and the os_client_config
find successfully the cloud
ok: [localhost] => {
"changed": false,
"clouds": [
{
"config": {
"api_timeout": null,
"auth": {
"endpoint": "https://192.168.170.3:6385",
"password": "[redacted]",
"username": "bifrost_user"
},
"auth_type": "http_basic",
"baremetal_introspection_endpoint_override": "https://192.168.170.3:5050",
"baremetal_introspection_status_code_retries": "5",
"baremetal_status_code_retries": "5",
"cacert": "/home/salvatoremazz/.config/openstack/bifrost.crt",
"cert": null,
"disable_vendor_agent": {},
"floating_ip_source": "neutron",
"image_api_use_tasks": false,
"image_format": "qcow2",
"image_status_code_retries": "5",
"interface": "public",
"key": null,
"message": "",
"network_api_version": "2",
"networks": [],
"object_store_api_version": "1",
"region_name": "",
"secgroup_source": "neutron",
"status": "active",
"verify": true
},
"name": "bifrost"
}
],
"invocation": {
"module_args": {
"clouds": [
"bifrost"
]
}
}
}
Then the next task fails because openstack.clouds
is not defined. Looking at the os_client_config module documentation os_client_config – Get OpenStack Client config — Ansible Documentation the facts should be set but they are not
these are the versions of the dependencies installed.
pip list
Package Version
------------------ -----------
ansible 5.10.0
ansible-core 2.12.10