Now, you’ll need to create an ansible.cfg in that directory, like this Step 2 - Create Playbookĭo the following to create the rest of the structure (from within the directory your Vagrantfile is in) mkdir -p vagrant/provisioning This will simply run the playbook that’s in the vagrant/provisioning subfolder of the Vagrantfile against all hosts. Lastly, we define the Ansible provisioner. Not necessarily bad, but I don’t like the idea of that very much. However, this is shared on VirtualBox with R/W access, which means that the box can modify your original files (including its own Vagrantfile). There is a default, which is for the folder the Vagrantfile is in to appear as /vagrant. Next up is we define a synced folder that will appear in the Vagrant box. First up, we define the default box we’re going to use, the memory allocated to it, our auto-update options and the hostname. # And finally run the Ansible local provisionerĬonfig.vm.provision "ansible_local" do |ansible|Īnsible.provisioning_path = "/vagrant/provisioning" # Mount this folder as RO in the guest, since it contains secure stuffĬonfig.vm.synced_folder "vagrant", "/vagrant", :mount_options => # Configure the hostname for the default machine # The default ubuntu/xenial64 image has issues with vbguest additions Make it look something like this # -*- mode: ruby -*. In a blank directory, edit a new Vagrantfile. Have a look at this gist for some info about how to do this. I’ll do an example later where this isn’t the case. I’ve chosen to use the ansible-local provisioner in this case, so that Ansible runs inside the Vagrant box. Since I’m converting all my builds and other things to use Ansible, the idea of using Ansible to customize a Vagrant box is very attractive.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |