ansible / molecule

Molecule aids in the development and testing of Ansible content: collections, playbooks and roles
https://ansible.readthedocs.io/projects/molecule/
MIT License
3.89k stars 665 forks source link

Vagrant driver adding unwanted entry on instance's /etc/hosts file #758

Closed viniciusfs closed 7 years ago

viniciusfs commented 7 years ago

Issue Type

Molecule and Ansible details

ansible --version
ansible 2.2.1.0
molecule --version
molecule, version 1.19.1

Desired Behaviour

Molecule needs to start a new instance and apply test playbook without apply any unwanted change on guest machine.

Actual Behaviour (Bug report only)

Molecule's builtin Vagrant runtime is always adding a 127.0.0.1 entry on guest's /etc/hosts file.

retr0h commented 7 years ago

Whats the harm with /etc/hosts containing the system's hostname? I don't see the harm in this.

viniciusfs commented 7 years ago

When I set ip address on instance definition, I need system hostname pointing to ip address set, not 127.0.0.1.

retr0h commented 7 years ago

That sounds like something that you can fix with ansible. If you don't like the way /etc/hosts is rendered, ansible can be used to correct it. I would prefer not to make a change of this nature.

viniciusfs commented 7 years ago

Conditional used on https://github.com/metacloud/molecule/blob/master/molecule/cookiecutter/driver/vagrant-runtime/%7B%7Bcookiecutter.repo_name%7D%7D/vagrantfile#L220 prevents this behavior while using libvirt provider. It is the same case, the difference is that when using virtualbox provider you must set a static ip to see this behavior.

retr0h commented 7 years ago

@viniciusfs I'm going to close this. If you are wanting to change the contents of /etc/hosts, feel free to write a lineinfile patch to your playbook and remove it.

viniciusfs commented 7 years ago

Thank you for your support! I will use libvirt driver that works like expected.