🌀Configuration of docker 🐳using ansible 💻

🎇 Task description -

We have to write an Ansible PlayBook that does the following operations in the managed nodes:

🔰 What is ansible ?

In ansible the node which we do configuration from is Controller Node and the node where we do configuration are Managed nodes.

For this task

🔰 Prerequisites —

♦ For our task we require two systems i.e one is controller node and one managed node for this you can install RHEL8 or any other Linux distribution .(In my case I am using RHEL8 for both controller as well as managed node.)

📍 Steps to install ansible and configure ansible -

  1. Install python3 (In my controller node python has installed already)and check it’s version
creating inventory file

📌 Now let’s create playbook for task

I have created separate files i.e yum.yml , docker.yml , import.yml and index.html

  1. docker.yml is for configuration of docker and to configure webserver(httpd) on container launched using docker .
  2. index.html — this is webpage
  3. import.yml — in this file I have imported all files mentioned above
  • By using volumes module we have attached /var/www/html folder of base OS to the folder (/usr/local/apache2/htdocs/) which present on launched container to copy html file into document root of apache present on docker container (i.e. webtask2)

Now verification done Finally task completed successfully..! 😊