Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic /etc/hosts entry for created machine #261

Open
gdubicki opened this issue Mar 7, 2022 · 1 comment
Open

Automatic /etc/hosts entry for created machine #261

gdubicki opened this issue Mar 7, 2022 · 1 comment

Comments

@gdubicki
Copy link
Contributor

gdubicki commented Mar 7, 2022

I am testing some Ansible playbooks on the machine in GCP created with Vagrant and this plugin.

I am using static Ansible inventory, so after I create a new vm I have to add/update its external IP address in the inventory file.
This is slightly annoying.

I could automate it by using the GCP dynamic inventory for Ansible but a) its configuration is an overkill for such a simple use case, b) it would add another extra step to regenerate the inventory after creating a new vm.

For my use case it would be cool if this plugin could create/update an /etc/hosts entry with the created vm external IP under some name, f.e. by default "vagrant".

Do you think this is a good idea?
Would a PR with such an optional feature be accepted?

@gdubicki
Copy link
Contributor Author

I started with printing out the external IP with shell provisioner:

  config.vm.provision "shell",
    inline: "echo External IP: $(curl -s icanhazip.com)"

gdubicki added a commit to gdubicki/vagrant-google that referenced this issue Mar 13, 2022
gdubicki added a commit to gdubicki/vagrant-google that referenced this issue Mar 13, 2022
gdubicki added a commit to gdubicki/vagrant-google that referenced this issue Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant