And I want to retrive first images with auth testing like below.
Also, I did install ansible 2.10.0.dev0
First, we shoud install "openstacksdk" with pip command like below.
oyj@controller:~/ansible/openstack$ pip install openstacksdk --user
#Create playbook like below.
oyj@controller:~/ansible/openstack$ cat os_imags_facts.yaml
---
- hosts: localhost
vars_prompt:
- name: openstack_admin_password
prompt: "What is openstack admin password?"
private: yes
tasks:
- name: get openstack images
os_image_facts:
auth:
auth_url: http://controller:5000/v3
username: admin
password: "{{ openstack_admin_password }}"
project_name: admin
delegate_to: localhost
- name: show images name only
debug:
msg: "image_name: {{ openstack_image[item].name}}"
loop: "{{ range(0,openstack_image|length)|list }}"
#I hava not inventories that I do not need in this playbook.
oyj@controller:~/ansible/openstack$ ansible-playbook os_imags_facts.yaml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
What is openstack admin password?:
PLAY [localhost] **************************************************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************************************************
ok: [localhost]
TASK [get openstack images] ***************************************************************************************************************************************
ok: [localhost -> localhost]
TASK [show images name only] **************************************************************************************************************************************
ok: [localhost] => (item=0) => {
"msg": "image_name: u16-server"
}
ok: [localhost] => (item=1) => {
"msg": "image_name: c7"
}
PLAY RECAP ********************************************************************************************************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
As a result,I have two images, c7 and u16server.
==
Thanks for reading