🔰 14.2 Further in ARTH — Task 10 have to create an
Ansible playbook that will retrieve newContainer IP
and update the inventory. So that further Configuration
of Webserver could be done inside that Container.
Basically, this task is mainly about, to create a docker container using ansible-playbook, then add the IP of container in ansible inventory so that we can do configuration inside that container using ansible-playbook.
For this, we should know one more concept i.e ansible behind the scene do ssh to target node and then commands in target node, so we must have ssh enabled in the target node.
If we want to make Container as target node of ansible, then ssh must be enabled in Container. But when we launch container, ssh is disabled in container by-Default.
So , I created one Image in which ssh is enabled, and we will use that Image to launch docker Container.
Dockerfile from which I created Image that have ssh enabled in it is;
And the ansible-playbook for the required task is
It will launch the container and put the IP of container in ansible inventory(ip3.txt) , so that we can configure the container by making it target node of the ansible.
Hence task Completed.