vagrant-ansible-lab-virtualbox
ginigangadharan
Credits:vagrant-iac-usecases
Forked From:This Vagrantfile creates 2 ansible nodes & 1 ansible engine. However, this script will not work in WSL/WSL2
Steps to Run:
-
Clone the github repo
-
Make sure Virtualbox is installed
-
Make sure Vagrant is installed
-
Make sure you have ssh keys present in ~/home/user/.ssh/ Follow this Guide to generate ssh keys
-
Navigate to the location of the repository
-
Run this command:
vagrant up
-
List status of running machines using:
vagrant status
-
Login to ansible-engine:
vagrant ssh ansible-engine
-
Check if you can ping ansible nodes:
ping ansible-node-1
Congrats! You can now work on Ansible. Want to code in vs-code?
-
You can open SSH into the remote container from vs-code using remote-ssh.
-
To get the ssh config file for ansible-engine type
vagrant ssh-config
& copy the configuration for ansible-engine -
Copy the output your SSH config file โ I added it to my default SSH config at ~/.ssh/config
-
You can use this info to SSH into container through vs-code & write scripts easily