To creating an Ansible playbook that will retrieve new Container IP and update the inventory. So that further Configuration of the web server could be done inside that Container.
First, we have to configure our new OS image then we have to set-up our OS image to support SSH login.
Then we will install openssh-clients, openssh-server, net-tools and passwd.
Now we will set a root passwd and then we will commit this image and save it as tar file to send it to the target node.
Now we can see that ssh-keygen has been created.
Now, we will create a new playbook for setting up a new docker from our created image of ssh configured. And run httpd service on our docker OS.
Now, we will run our Ansible playbook.
We can now see that our Ansible playbook has successfully run.
And our inventory has been successfully updated with the docker IP.