ARTH TASK 23 [📌 Automate Kubernetes Cluster Using Ansible 🔅 Launch ec2-instances on AWS Cloud eg. for master and slave. 🔅 Create roles that will configure master node and slave node seperately. 🔅 Launch a wordpress and mysql database connected to it in the respectine slaves. 🔅 Expose the wordpress pod and client able hit the wordpress ip with its respective port. ]
Installing Python3: $ yum install python3 -y Installing the boto3 library: $ pip3 install boto Creating a inventory directory: $ mkdir -p /opt/ansible/inventory $ cd /opt/ansible/inventory Creating a file aws_ec2.yaml in the inventory directory with the following configuration: plugin: aws_ec2 aws_access_key: <YOUR-AWS-ACCESS-KEY-HERE> aws_secret_key: <YOUR-AWS-SECRET-KEY-HERE> keyed_groups: - key: tags prefix: tag Open /etc/ansible/ansible.cfg and find the [inventory] section and add the following line to enable the ec2 plugin: [inventory] enable_plugins = aws_ec2 Now let’s test the dynamic inventory configuration by listing the EC2 instances: $ ansible-inventory -i /opt/ansible/inventory/aws_ec2.yaml --list The above command returns the list of EC2 instances with all its parameters in JSON format. Now, check if Ansible is able to ping all the machines returned by the dynamic inventory: ansible all -m ping Dynamic inventory setup done. Launch...