Source: gupta-aditya333.medium.com

Docker Automation using Ansible
So hey guys hope you all are doing today we are going to automate docker using ansible and launch our website using docker httpd image we are going to start from scratch completely new operating system yum configuration, docker installation, enabling services, launching containers all things in just line of commands excited!! For automation, we are going to use a Product called Ansible if you don't know what is Ansible, benefits of ansible then you can check my previous article to get insights into Ansible. In ans ible we have to make inventory that contains all IP for that you can make one text file at any location you want and inside that we have to give our target node IP, username, password, connection medium as shown below.

In the above picture you can see host_key_checking = False is used we might have connected to the remote system before using ansible via ssh and in that case, one key is saved in the .ssh folder to avoid the checking of that key we have used this parameter.

To download docker we have used command module to download python3 we use yum and to download python library we have used pip module to enabling docker services we use service module and to make directory we use file module and to copy file we have template module and launching container we have used docker_container module.

Related Articles