DevOps Classroomnotes 02/Jan/2022

Activity 5: Lets create our own module and use it

  • Refer Here for the changes done to reuse existing modules

Activity 6: Running Ansible from Terraform Provisioning

  • To create this template i will be using AWS.
  • To fetch the vpc id, we would be using a datasource. A data source in terraform can fetch the information
  • Refer Here for the official docs of the vpc datasource
  • Refer Here for the changes done to create an ec2 instance by fetching info from data sources
  • Setup for Running Ansible from terraform provisioner
    Preview
  • Now create a ubuntu linux vm in the cloud of your choice
  • Install aws cli Refer Here
sudo apt update
sudo apt install unzip -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
  • Now configure AWS CLI aws configure
  • Install terraform on linux Refer Here
  • Install Ansible on linux Refer Here
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
ansible --version
  • Ensure all the necessary softwares are installed as mentioned above to check refer the below image
    Preview
  • Refer Here for the changes done with playbook and ensure python3 is installed on new node created
  • Refer Here for the ansible playbook execution command added to provisioner
    Preview
  • Refer Here for the terraform template which calls ansible playbook

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner