Source: gupta-aditya333.medium.com

How To SSH Into Docker Container Using Ansible
Hey guys hope you all are doing in today's article we are going to see how can we directly run ansible-playbook directly into the docker container. Isn't it interesting just think one playbook launching container for us updating inventory and when we run another playbook it will configure the container to run an apache web server. To continue with this practical we will be needed a docker image that has ssh enabled in it you can use any but if don’t know how you can read this article Once you have an image with ssh enabled we are ready to write the playbook we are going to write two playbook one for launching container and updating inventory and one for configuring container

The above playbook is used to configure the container here we are configuring an apache web server in a container from ansible master node when we run this playbook it will ask the name of the file and content that we want to put in the file.

Related Articles