ARTH — Task 14 👨🏻‍💻

Saranya. S
4 min readApr 4, 2021

Task Description📄

🔰 14.2 Further in ARTH — Task 10 has to create an Ansible playbook that will retrieve new container IP and update the inventory. So that further Configuration of Webserver could be done inside that Container.

STEP:1: PRE -REQUIRITIES:

  1. Install “ansible” in the controller node.
CMD: yum install ansible

TO CHECK:

||cmd: ansible --version

2. Install “docker” in the controller node[from task10].

TO CHECK:

||cmd: rpm -q docker-ce

* To start your docker service
cmd: systemctl start docker
*To see status of your docker service
cmd: systemctl status docker

STEP:2: Launch Docker Container…

cmd: docker run -it  --name  <Container_Name>  <docker_image_name>:<version>

TO CHECK :

* To see images in docker
cmd: docker images
* To see at present running images
cmd: docker ps -a

STEP:3: Install required packages in the docker container…

* To install SSH server
cmd: yum install openssh-server -y
* To install SSH client
cmd: yum install openssh-clients -y
* To install passwd
cmd: yum install passwd -y
INSTALL SSH SERVER
INSTALL SSH CLIENT
INSTALL PASSWD
  • Set the password for root
cmd: passwd root

NOTE: USE “ ssh-keygen -A” TO AVOID THE KEY ERROR.

TO CHECK :

STEP:4: Create an image of the container …

cmd: docker commit <image_id> <image_name>:<version>

To check : cmd: “docker images”

STEP:5: Push the image into the docker hub…

STEP:6: Install docker-py library…

cmd: pip3 install docker.py

STEP:7: Create a playbook to pull pre-created image…

STEP:8: Create a playbook to configure httpd …

Before running playbook inventory is:

STEP:9: Run the Ansible-playbook…

  1. Run playbook task14.2.yml:

After running playbook inventory is:

2. Run playbook httpd.yml:

TO CHECK :

TASK ENDS…

--

--