Ansible Automated Configuration
This project sets up an environment with Vagrant-managed virtual machines and configures them using Ansible. It's designed to showcase how to automate the provisioning and management of multiple servers.
Before you begin, ensure you have the following installed:
Clone this repository to your local machine using:
git clone [email protected]:kamreo/devops-portfolio.git
Change into the project directory:
cd ansible-automated-configuration
Navigate to the Vagrant directory and start up the virtual machines:
cd vagrant
vagrant up
This will read the Vagrantfile
and provision the virtual machines as configured.
Ensure all Vagrant machines are running correctly:
vagrant status
Navigate back to the project root and run the Ansible playbook:
cd ..
ansible-playbook -i inventory.ini site.yml
This command runs the site.yml
playbook using the hosts defined in inventory.ini
.
After the playbook execution, verify that the configuration is applied correctly to the servers. How you do this will depend on what your playbook does (e.g., if it installs a web server, you might visit the IP of one of the VMs in a browser).
If you need to access the Vagrant machines directly, you can SSH into them:
vagrant ssh server1
Replace server1
with the appropriate machine name as defined in your Vagrantfile.
When you’re done, you can stop the Vagrant machines:
vagrant halt
- If Ansible can't connect to the Vagrant machines, ensure that SSH access is correctly set up and that the IP addresses and paths in the
inventory.ini
file are correct. - If you encounter errors with the tasks in the Ansible playbook, check the task's documentation and ensure all required parameters are provided.