ARTH — Task 14 👨🏻💻
3 min readApr 3, 2021
Task Description📄
🔰 14.3 Create an Ansible Playbook which will dynamically load the variable file named the same as OS_name and just by using the variable names we can Configure our target node. ( Note: No need to use when keyword here. )
TASK BEGINS….
STEP:1: Launching 3 Instances In AWS …
1. controller node
2. UBUNTU
3. RedHat
Note: you can launch any nos of instances(different os).
STEP:2: Connect to controller node…
- open with root
cmd: sudo su - root
- Move the key (.pem) to the controller node using WinSCP and then to the root.
cmd: sudo mv <key_name>.pem /root
- Create inventory file.
cmd: vim ip.txt
- Install ansible.
cmd: sudo amazon-linux-extras install ansible2
- Write an ansible configuration file.
cmd: vim ansible.cfg
TO CHECK :
||To check the hosts:
cmd: ansible all --list-hosts
||To ping:
cmd: ansible all -m ping
STEP:3: Create the variable file in the controller node…
STEP:3.1: For RedHat OS
cmd: vim RedHat.yml
STEP:3.2: For Ubuntu OS
cmd: vim Ubuntu.yml
STEP:4: Create a playbook to configure webserver
cmd: vim pb_task14.3.yml
NOTE: create a Html file
cmd: vim index.html
STEP:5: Run the Ansible playbook…
cmd: ansible-playbook pb_task14.yml
TO CHECK :