Integrating Docker and HTTPd service via Ansible playbook

Jayesh Kumar
3 min readMar 21, 2021

--

First, we would install ansible on our system

pip3 install ansible

We would create an inventory file via command:

vim in.txt

Configuring inventory file.

Updating the Configuration file by providing the address of the inventory file.

Creating a new folder workbook for ansible-playbook.

Then we would launch the docker container on the target node and mount the /usr/local/apache2/htdocs on the previously created folder and port 80 of the container will be attached to a new port of the target node. (here 8081)

Then we would apply no restriction on ports via firewalld module.

Then we would run the ansible-playbook over the desired target node to configure the docker and run the httpd service.

Now we can manually check the working of the playbook by opening the target node and writing the command docker ps.

Now we can open the browser and check that our HTML pageis hosted on the internet.

--

--

Jayesh Kumar
Jayesh Kumar

Written by Jayesh Kumar

Btech ECE pursuing student ....Arth Learner

No responses yet