Skip to content

Instantly share code, notes, and snippets.

@mattpwest
Last active September 2, 2021 07:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpwest/e1b979edac93b81824da9a5dfb774191 to your computer and use it in GitHub Desktop.
Save mattpwest/e1b979edac93b81824da9a5dfb774191 to your computer and use it in GitHub Desktop.
Vagrant - Ubuntu 18.04: Provision Ansible with Python 3
if [ ! -f "/home/vagrant/.ssh/id_rsa" ]; then
ssh-keygen -t rsa -N "" -f /home/vagrant/.ssh/id_rsa
fi
cp /home/vagrant/.ssh/id_rsa.pub /vagrant/control.pub
cat << 'SSHEOF' > /home/vagrant/.ssh/config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
SSHEOF
chown -R vagrant:vagrant /home/vagrant/.ssh/
sudo apt-get update
sudo apt-get install -y python3 python3-pip
sudo pip3 install ansible
cd /vagrant
ansible-galaxy install -r requirements.yml
cp -R /root/.ansible /home/vagrant/.
chown -R vagrant:vagrant /home/vagrant/.ansible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment