Open main menu

Changes

adds note about running ad-hoc ansible commands against vagrant
== Run "locally" or from the control host? ==
Note that Vagrant offers both 'ansible' and 'ansible_local' provisioners <ref>https://www.vagrantup.com/docs/provisioning/ansible_local.html</ref>. The first executes ansible from the control host. The latter ('local') executes Ansible from the guest and will attempt to install Ansible when not present.
 
Also, you do not have to '''only''' run 'vagrant up --provision' to re-provision a host. You can run ad-hoc ansible commands by utilizing the specific hosts file created by the initial <code>vagrant up</code> e.g.
<pre>ansible-playbook --private-key=.vagrant/machines/qualitybox/virtualbox/private_key -u vagrant -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --become provision.yml</pre> However, when doing this you may be skipping over prior steps which define certain variables. In that case, you should add <code>--extra-vars</code> on the command-line.
<pre>ansible-playbook --private-key=.vagrant/machines/qualitybox/virtualbox/private_key -u vagrant -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --become provision.yml --start-at-task="setup" --extra-vars 'wiki_hostname=wiki.example.com apache_user=www-data'</pre>
== Options ==
4,558

edits