Skip to content

dmotte/vagrant-ansiblebox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-ansiblebox

GitHub main workflow Vagrant Cloud

📦 Debian Vagrant box with Ansible and Ansible Lint installed via APT.

Since Ansible cannot run natively on a Windows host, this Vagrant box can be useful if you need Ansible but you're using Windows on your controller.

📦 This box is also on Vagrant Cloud as dmotte/ansiblebox.

Usage

See https://github.com/dmotte/misc/blob/main/examples/vagrant-ansible-provisioner for inspiration on how you could use this box.

If you want your host SSH identity keys and known_hosts to be available inside the VM, you can mount the host's ~/.ssh directory like this:

config.vm.synced_folder "~/.ssh", "/home/vagrant/.ssh-host",
    mount_options: ["dmode=700,fmode=600"]

Then you'll need to add some directives to the ~/.ssh/config file inside the VM:

config.vm.provision "shell", privileged: false, inline: <<-SHELL
    touch ~/.ssh/config; chmod 600 ~/.ssh/config
    echo "UserKnownHostsFile ~/.ssh-host/known_hosts" >> ~/.ssh/config
    echo -e "Host *\n    IdentityFile ~/.ssh-host/id_ed25519" >> ~/.ssh/config
SHELL

If you want to install additional packages:

config.vm.provision "shell", inline: <<-SHELL
    apt-get update; apt-get install -y rsync
SHELL