hello,

      I have to create compute instance in Openstack. I used os_server 
Ansible module.

It creates instance successfully. 
But Playbook failed with error message "msg": "Timeout waiting for the 
floating IP to be attached."

Playbook is:

---
- name: Create Instance Using Ansible Module
  hosts:
    - 127.0.0.1
  gather_facts: true
  tasks:
    - name: Create new VM
      os_server:
        name: demo_instance
        image: yellow-6.6.2-2
        flavor: 1021
        endpoint_type: internal
        state: present
        wait: yes
        floating_ip_pools: fips-prod     #[root@controller work]# nova 
floating-ip-pool-list
        nics:
          - net-id: 022f7ae4-358d-4e8d-9ec4-bb123105febf
        #timeout: 360
        api_timeout: 60



----------------------------------------------------------------------------------------------------------
Error Log:

[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 .

Below is my Environment,


1. Python Version:
[root@controller work]# python --version
Python 2.7.5

2. Ansible Version:
[root@controller work]# ansible --version
ansible 2.0.0.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

3. Shade Version
[root@controller work]# pip list |grep shade
shade (1.4.0)



Below is the code snippet from 
 "/usr/lib/python2.7/site-packages/shade/openstackcloud.py"

where timeout occures,

 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

-- 
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/a863bf35-91e3-425e-98af-3ebb2e06c3eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to