Molecule: Docker driver doesn't support etc_hosts from docker_container module

Created on 26 Mar 2019  路  2Comments  路  Source: ansible-community/molecule



Issue Type

  • Bug report

Molecule and Ansible details

$ ansible --version && molecule --version
ansible 2.7.8
  config file = None
  configured module search path = [u'/Users/tomasz/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/tomasz/Library/Python/2.7/lib/python/site-packages/ansible
  executable location = /Users/tomasz/Library/Python/2.7/bin/ansible
  python version = 2.7.15 (default, Feb 12 2019, 12:27:02) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
molecule, version 2.20.0

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

  • No linters or tests, the problem is on create.yml phase.

Desired Behavior

I'm trying to overwrite some domain with etc_hosts from docker_container module:

platforms:
  - name: instance1
    image: ubuntu:16.04
    groups:
      - haproxy-group
    etc_hosts:
      - "prometheus.local": "{{ ansible_default_ipv4.address }}"

There should be new entry in /etc/hosts:

172.17.0.3    prometheus.local

Actual Behaviour

There's no entry in /etc/hosts:

root@instance1:/# cat /etc/hosts
127.0.0.1    localhost
::1    localhost ip6-localhost ip6-loopback
fe00::0    ip6-localnet
ff00::0    ip6-mcastprefix
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters
172.17.0.3    instance1
bug

All 2 comments

Yep, we're missing that option.

                'etc_hosts': {
                    'type': ['string', 'dict'],
                    'keysrules': {'type': 'string'},
                },

Does now!

Was this page helpful?
0 / 5 - 0 ratings