I have to create compute instance in Openstack. I used os_server Ansible module.
But Playbook failed with error message "msg": "Timeout waiting for the floating IP to be attached."
----------------------------------------------------------------------------------------------------------
[root@controller work]# ansible-playbook ans_vm.yml -vvv -c local
Using /etc/ansible/ansible.cfg as config file
1 plays in ans_vm.yml
PLAY [Create Instance Using Ansible Module] ************************************
TASK [setup] *******************************************************************
ESTABLISH LOCAL CONNECTION FOR USER: root
127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453636428.81-185608771049201 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453636428.81-185608771049201 )" )
127.0.0.1 PUT /tmp/tmpuedjgm TO /root/.ansible/tmp/ansible-tmp-1453636428.81-185608771049201/setup
127.0.0.1 EXEC LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1453636428.81-185608771049201/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1453636428.81-185608771049201/" > /dev/null 2>&1
ok: [127.0.0.1]
TASK [Create new VM] ***********************************************************
task path: /root/work/ans_vm.yml:7
ESTABLISH LOCAL CONNECTION FOR USER: root
127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1453636429.08-171393797128186 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1453636429.08-171393797128186 )" )
127.0.0.1 PUT /tmp/tmpiF8gT_ TO /root/.ansible/tmp/ansible-tmp-1453636429.08-171393797128186/os_server
127.0.0.1 EXEC LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1453636429.08-171393797128186/os_server; rm -rf "/root/.ansible/tmp/ansible-tmp-1453636429.08-171393797128186/" > /dev/null 2>&1
fatal: [127.0.0.1]: FAILED! => {"changed": false, "extra_data": null, "failed": true, "invocation": {"module_args": {"api_timeout": 60, "auth": null, "auth_type": null, "auto_ip": true, "availability_zone": null, "boot_from_volume": false, "boot_volume": null, "cacert": null, "cert": null, "cloud": null, "config_drive": false, "endpoint_type": "internal", "flavor": 1021, "flavor_include": null, "flavor_ram": null, "floating_ip_pools": "fips-prod", "floating_ips": null, "image": "yellow-6.6.2-2", "image_exclude": "(deprecated)", "key": null, "key_name": null, "meta": null, "name": "demo_instance", "network": null, "nics": [{"net-id": "022f7ae4-358d-4e8d-9ec4-bb123105febf"}], "region_name": null, "security_groups": ["default"], "state": "present", "terminate_volume": false, "timeout": 180, "userdata": null, "verify": true, "volume_size": false, "volumes": [], "wait": true}, "module_name": "os_server"}, "msg": "Timeout waiting for the floating IP to be attached."}
PLAY RECAP *********************************************************************
127.0.0.1 : ok=1 changed=0 unreachable=0 failed=1
-----------------------------------------------------------------------------------------------------------------------------------------------
I am exporting Open stack environment variables through Openstackrc.sh .
1. Python Version:
2. Ansible Version:
3. Shade Version
Below is the code snippet from "/usr/lib/python2.7/site-packages/shade/openstackcloud.py"
if wait:
# Wait for the address to be assigned to the server
server_id = server['id']
for _ in _utils._iterate_timeout(
timeout,
"Timeout waiting for the floating IP to be attached."):
server = self.get_server_by_id(server_id)
ext_ip = meta.get_server_ip(server, ext_tag='floating')
if ext_ip == floating_ip['floating_ip_address']:
return server
return server