简体   繁体   中英

Problems with using Ansible 1.9 to assign floating IPs to OpenStack Nova instance

I'm trying to configure Ansible 1.9 to launch some OpenStack Nova instances. For each instance, I'm attempting to auto-assign a floating IP, connecting it to a public segment. When I try this:

- name: launch  Web01  instance
  hosts: csc
  tasks:
   - nova_compute:
      state: present
      login_username: tenant_2_user
      login_password: hello
      login_tenant_name: tenant_2
      name: Web01
      auth_url: http://mylocalhost:5000/v2.0/
      region_name: RegionOne
      image_id: 95c5f4f2-84f2-47fb-a466-3c786677d21c
      wait_for: 200
      flavor_id: b772be9a-98cd-446f-879e-89baef600ff0
      security_groups: default
   - neutron_floating_ip:
      state=present
      login_username=tenant_2_user
      login_password=hello
      login_tenant_name=tenant_2
      network_name=ext-net
      instance_name=Web01

I get : ERROR: neutron_floating_ip is not a legal parameter in an Ansible task or handler

And when I try this:

- name: launch  Web01  instance
  hosts: csc
  tasks:
   - nova_compute:
      state: present
      login_username: tenant_2_user
      login_password: hello
      login_tenant_name: tenant_2
      name: Web01
      auth_url: http://mylocalhost:5000/v2.0/
      region_name: RegionOne
      image_id: 95c5f4f2-84f2-47fb-a466-3c786677d21c
      wait_for: 200
      flavor_id: b772be9a-98cd-446f-879e-89baef600ff0
      security_groups: default
      auto_floating_ip: yes

msg: unsupported parameter for module: auto_floating_ip

Here is my Ansible version: ansible --version ansible 1.9 configured module search path = /usr/share/ansible

What can I do to have Ansible assign these floating IPs?

-Eugene

I got it working. You dont need to use

 auto_floating_ip: yes 

just use

  floating_ip_pools: - Your-external/public-network-id 

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM