Integrating Ansible, Docker & Apache Web-Server
Published in
Apr 7, 2021
Our goal is to create an Ansible playbook to retrieve new container IP and update the inventory to configure webserver inside that container.
We begin with writing our ansible configuration file:
[defaults]
inventory=inventory.txt
host_key_checking=false
Then we add a template for our inventory.
[webserver]
{{ dockerip.container.NetworkSettings.IPAddress }} ansible_ssh_user=root ansible_ssh_pass=root
Now its time to create two playbooks which should look something like:
Running the playbooks:
And finally this is our website:
Feel free to contact on my LinkedIn.