Can't get os_network to work.

55 views
Skip to first unread message

Cees Moerkerken

unread,
Apr 19, 2016, 11:12:31 AM4/19/16
to Ansible Project, ce...@cloudvps.com
Hi all,

I have successfully managed to deploy some cloud servers with ansible 2.0 on openstack, but seem to get stuck on creating the network.

State should not be required according to http://docs.ansible.com/ansible/os_network_module.html.

When i comment out the state parameter i get:
TASK [os_network : OpenStack | create network] *********************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1461078444.28-238290358250568/os_network\", line 2144, in <module>\r\n    main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1461078444.28-238290358250568/os_network\", line 78, in main\r\n    state = module.params['state']\r\nKeyError: 'state'\r\n", "msg": "MODULE FAILURE", "parsed": false}

And when i uncomment the state parameter i get:
TASK [os_network : OpenStack | create network] *********************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: state"}


My ansible role looks like:

---

- name: OpenStack | create network
  os_network:
    cloud: testing
    state: present
    name: "{{ private_net_name }}"
  register: mynetwork


Any help or ideas would greatly be appreciated!

Greets,
Cees

David Shrewsbury

unread,
Apr 19, 2016, 1:58:05 PM4/19/16
to Ansible Project, ce...@cloudvps.com
Hi,

This is very odd. I'm unable to reproduce this with Ansible 2.0. Are you using the latest release?
Do you have any more verbose output to share, or a complete playbook that reproduced the problem?

-Dave

Cees Moerkerken

unread,
Apr 20, 2016, 5:08:17 AM4/20/16
to Ansible Project, ce...@cloudvps.com

I was using a clone from https://github.com/ansible/ansible/tree/stable-2.0.0.1, now i've installed the latest version via the ppa, but it might jus be that the vm i'm using is a bit messed up. I will create a new, clean vm with just the ppa install and report back.

with the state parameter the verbose output is:
failed: [127.0.0.1] => {"failed": true, "playbook": "deploy.yml", "role": null, "task": "OpenStack | create network"}
msg: unsupported parameter for module: state

FATAL: all hosts have already failed -- aborting

without the state parameter the output is:
failed: [127.0.0.1] => {"failed": true, "parsed": false, "playbook": "deploy.yml", "role": null, "task": "OpenStack | create network"}
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1461143206.36-132434212146433/os_network", line 1844, in <module>
    main()
  File "/root/.ansible/tmp/ansible-tmp-1461143206.36-132434212146433/os_network", line 77, in main
    state = module.params['state']
KeyError: 'state'
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 15122
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 0
Shared connection to 127.0.0.1 closed.


The playbook is:

---

- hosts: localhost
  tasks:
  - name: OpenStack | create network
    os_network:
      name: "test2"
#      state: present
      auth:
        auth_url: "{{ os_auth.auth_url }}"
        username: "{{ os_auth.username }}"
        password: "{{ os_auth.password }}"
        project_name: "{{ os_auth.project_name }}"

Op dinsdag 19 april 2016 19:58:05 UTC+2 schreef David Shrewsbury:
Reply all
Reply to author
Forward
0 new messages