Skip to main content

Simple helper to use ansible with vagrant

Project description

Tired of the rather limited vagrant provision with the ansible provider? Tired of keeping your hosts file up to date? ansible-vagrant to the rescue!

Usage

$ pip install ansible-vagrant
$ cd /path/to/project/with/a/vagrantfile

$ ansible-vagrant-update-hosts
$ cat hosts_vagrant
[vagrant]
vagrant  ansible_ssh_host=127.0.0.1  ansible_ssh_port=2222  ansible_ssh_use...

$ ansible-vagrant all -m ping
# Same as: ansible-vagrant-update-hosts \
#          && ansible all --inventory=./hosts_vagrant -m ping

$ ansible-playbook-vagrant playbook.yml
# Same as: ansible-vagrant-update-hosts \
#          && ansible-playbook --extra-vars="vagrant_host=true" \
#                              --inventory=./hosts_vagrant playbook.yml

Notes

  • All *-vagrant commands use ANSIBLE_HOST_KEY_CHECKING=False to prevent errors with vagrant destroy && vagrant up

  • It’s a good idea to put hosts_vagrant under .gitignore

  • ansible-playbook-vagrant adds a global variable named vagrant

  • Use when: vagrant_host is (not) defined to run stuff based on the current environment

Shortcuts

  • ansiblev for ansible-vagrant

  • ansible-playbookv for ansible-playbook-vagrant

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansible-vagrant-1.3.0.tar.gz (2.0 kB view details)

Uploaded Source

File details

Details for the file ansible-vagrant-1.3.0.tar.gz.

File metadata

File hashes

Hashes for ansible-vagrant-1.3.0.tar.gz
Algorithm Hash digest
SHA256 a1c6f5bb9eeee99177873ad5767800b30e75669202d4fa4e034f991b4a4305b4
MD5 5bf5133ba6550cf5eb9da6846848f389
BLAKE2b-256 91228e58ce15756f83d7db986ebaebea7e659039ddac62073ba5c270a6d1bca3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page