Step-by-step process to install docker using ansible playbook
Launch two EC2 Instances, one is master and another one is slave. with the help of master-slave configuration, we need to install docker package into slave instance through, master instance.
Step 1: Launch an instance
- now, make master-slave configuration.
- Connect the master instance and check for installed packages
$cd /etc/ → $ ls (check for ansible..) if it is not installed
Step 2: Install Ansible
$sudo amazon-linux-extras install ansible2
- Now go to /etc/ and check for ansible…. If package Installed, then go to hosts file and make a
- Master Slave configuration
$cd /etc/ → ls → cd ansible → sudo vi hosts
- Save and exit
- Now, check for newly added ip address from master instance terminal by using command; $ ansible all –list-hosts
- Now, make a communication to all the slave instances from Master instance by using command; $ ansible all -m ping
- Master – Slave Configuration done successful…!!
- Now, with the help of ansible playbook, we need to install docker package into the instance.
- So, Now by using Master server ..we are going to install docker package in Slave instance…for
- that am going to create a playbook
Step 3: Create Playbook
- Make a directory for playbooks need to perform to communicate with all the rest Slave servers…
$ mkdir playbooks
- Go to that directory and create a .yml extension filed playbook to install Docker package.
$sudo vi package.yml
- save the file.
Step 4: Run the Playbook
- Execute the playbook, by using following command
$ansible-playbook package.yml
Step 5: Verify
- Now, check Docker is installed or not in slave servers. In slave instance terminal, using command, $ docker -version
- Docker enables you to build, test and deploy applications and package applications and their dependencies into containers, ensuring consistency across different environments. Installing Docker on Amazon Linux AMI enables users to leverage Docker’s capabilities for their applications running on AWS infrastructure.
How To Install Docker Using Ansible Playbook ?
Docker is a software platform that allows you to build, test and deploy applications that use OS-Level virtualization to deliver software in packages called “containers”. Containers – Docker package software into standardized units called “Containers”. Docker is a stand-alone tool. which means no need to install run-time. The manner in which we make, convey, and oversee programming applications has been totally changed by Docker. An incredible asset packs applications into lightweight, convenient compartments, making it simpler to construct, boat, and use them.