Hi,
I use Ansible to create servers on OpenStack and to install mysql on it.
All is done once, so in my code I want to register the public IP of the new
server and store it in my Ansible hosts file. But it does not seem to work:
- name: launch an instance
os_server:
state: present
auth:
auth_url: "{{ item.value.auth_url }}"
username: "{{ item.value.username }}"
password: "{{ item.value.password }}"
project_name: "{{ item.value.project_name }}"
region_name: "{{ item.value.region_name }}"
name: "{{ item.value.name }}"
image: "{{ item.value.image }}"
state: present
network: "{{ item.value.network }}"
flavor: "{{ item.value.flavor }}"
key_name: "{{ item.value.key_name }}"
user_data: "{{ item.value.user_data }}"
with_dict: "{{ openstack_hosts }}"
register: mysqlserver
#- set_fact: public_v4="{{ mysqlserver.server.public_v4 }}"
- name: output of the registred variable
debug:
var: "{{ item.key }}"
with_dict: "{{ openstack_hosts }}"
If I make a debug of "mysqlserver" variable it shows me a big JSON output
where I can see the public IP address but "mysqlserver.server.public_v4"
doest not output anything.
I suspect the "with_dict" calls because without this it works, weiird!
I need "with_dict" because I want to have many servers.
Any ideas please?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/63e084b8-5d0f-49b2-a14a-d929af1308cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.