Ansible and docker
ANSIBLE OVERVIEW-
Ansible is an IT automation tool used by various companies to configure systems, deploy software an much more. Its main advantage is the ease with which it can do certain complex and time consuming tasks. Ansible is agent less, hence you need ansible only on controller node and not on target node which is not available on puppet(other configuration tool).
DOCKER OVERVIEW-
Docker is a software platform for building applications based on containers — small and lightweight execution environments that make shared use of the operating system kernel but otherwise run in isolation from one another. While containers as a concept have been around for some time, Docker, an open source project launched in 2013, helped popularize the technology, and has helped drive the trend towards containerization and micro services in software development that has come to be known as cloud-native development.
Task 10-
Step 1- Install ansible on the controller node. (pip3 install ansible)
Step2- Create inventory for ansible.
Step3- Provide inventory to ansible configuration file.
Step4- Check all the hosts. (ansible all — list-hosts), and then ping all the hosts available. (ansible all -m ping)
Step4 -Create Playbook!
1> Creating a repository of docker and configuring it.
2>Installing docker.
3>Starting the docker on the target node.
4>Installing per-requisites file. (docker - py library)
5>Creating a folder on the target node. (task100)
6> Copying local HTML file from the controller node to the newly created folder on the target node.
7>Pull a HTTPD image- using docker_image module
8>Launched a container name as “webcontainer” — using docker_container module . Image used — httpd:latest, published_port 80 of container to unused port 8088 of base host OS (Linux VM) , volume mounted onto the directory /Task100 .
9>Configuring firewall for port 8088/tcp.
10>Saving the playbook.
STEP5-Testing the playbook-
Using the command ansible -playbook <name of the playbook.yml>
NOTE: Green color means no change at target node, yellow means change and red means error!
As the playbook ran successfully at the target node, there is no error.