Hello connection Today we configure docker using ansible and do lots of things…
Write an Ansible PlayBook that does the following operations in the managed nodes:
🔹 Configure Docker
🔹 Start and enable Docker services
🔹 Pull the httpd server image from the Docker Hub
🔹 Run the httpd container and expose it to the public
🔹 Copy the html code in /var/www/html directory and start the web server
About Ansible :-
Designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time.
It uses no agents and no additional custom security infrastructure, so it’s easy to deploy — and most importantly, it uses a very simple language (YAML, in the form of Ansible Playbooks) that allow you to describe your automation jobs in a way that approaches plain English.
Required Tools & Software :-
- RHEL 8 (Manager Node/Controller Node)
- ANOTHER VM LIKE RHEL 8 (Managed Node)
Hope you Know the step how to install ansible in rhel8 :
oops so you dont know how to install ansible ?????
So lets show how to install ansible in rhel8 ………..
so first let me tell you ansible is made in the top of python so first we shoud check weather python is there or not !!
if python is not installed use this command ->
>> yum install python3
After install python use pip (package manager )
>> pip3 install ansible
so it will finally install ansible
After installing ansible lets come to the main part of configuration of docker with ansible !!!
So as you know there is controller node and managed node is there !
Controller node !
so 192.168.69.157 is my controller node which will control all the managed node !
Managed node !
192.168.29.55 is my managed node
lets come to the installation of docker using ansible
lets go the controller node and see my yml configuration !
so before this lets see some basic commands in ansible !
To see both the system is pinging use this command
>> ansible all -m ping
lets see in Gui …..
so from controller node managed node is pinging !
lets see the configuration !
so using this command we can see out inventory and config file !!
after all thing is done lets see how to install docker using ansible !!!
1 > create anyfile using .yml extension !
and write this configuration !
After writing this configuration save this yml file
and use playbook command !
>> ansible-playbook filename !
like my file name is docker.yml so i use this command
>> ansible-playbook docker.yml
“After compile you will get this type of output and belive me in just a single click our entire infrastructure is launched like suppose i want to launch hadoop cluster or spark cluster or like in java jboss server or tomcat server in just a single click entire infrastructure is launched !!”
So lets come to the managed node :)
so we can see do in the configuration of controller node is there in managed node !!
github url -> https://github.com/ROHITkumaw/ansiblecodeusingdocker
feel free to contact at -> https://www.linkedin.com/in/rohit-kumar-4b5183181/