docker_container network issue

18 views
Skip to first unread message

sn.laza...@gmail.com

unread,
Jul 26, 2017, 11:53:04 AM7/26/17
to Ansible Project
Hi, I've been using the docker_container module. So far it's working when creating the image and other options, but when the "networks" option is used then the issue arise.

Here's the details:

ansible version: ansible 2.2.1.0 (master d5f68d2824) last updated 2017/07/26 15:11:46 (GMT +800)
docker-py version: docker-py (1.9.0)
docker version:   1.9.0
docker API version:  1.21

Error encountered: 

fatal
: [10.0.1.110]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Warning: Permanently added 'host here' (ECDSA) to the list of known hosts.\r\nWarning: Permanently added '10.0.1.110' (ECDSA) to the list of known hosts.\r\nTraceback (most recent call last):\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 2007, in <module>\n    main()\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 2000, in main\n    cm = ContainerManager(client)\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 1652, in __init__\n    self.present(state)\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 1696, in present\n    container = self.update_networks(container)\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 1761, in update_networks\n    has_network_differences, network_differences = container.has_network_differences()\n  File \"/tmp/ansible_cdG2O6/ansible_module_docker_container.py\", line 1374, in has_network_differences\n    if connected_networks.get(network['name'], None) is None:\nAttributeError: 'NoneType' object has no attribute 'get'\nKilled by signal 1.\r\n", "module_stdout": "", "msg": "MODULE FAILURE"}




Playbook:
- name: Pull and spawn docker image {{ container_name }} {{ container_tag }}
  docker_container
:
    name
: "{{ container_name }}"
    image
: "{{ docker_image }}"
    state
: present
    ports
: "{{ container_ports|default(omit) }}"
    pull
: true
    networks
:
     
- name: bridge
        ipv4_address
: "{{ docker_image }}"



There error doesn't appear when I don't include any network option in docker_container module. Any help why this is happening?

Thanks!
Reply all
Reply to author
Forward
0 new messages