Below is the topology that I have used to install the Apache webserver via Ansible.
![This image has an empty alt attribute; its file name is image-460.png](https://tungle.ca/wp-content/uploads/2022/01/image-460.png)
Make sure the Debian server allows Linuxmint to access by using Public key authentication.
![](https://tungle.ca/wp-content/uploads/2022/01/image-518.png)
On Linuxmint sever.
Create a new tungapache.yaml file
---
- hosts: tunglamp
become: yes
vars:
firstname: "XXX"
lastname: "YYY"
tasks:
- name: Update Debian Server 10 System packages
become: yes
apt: update_cache=yes
- name: install apache2
apt: name=apache2 state=latest
- name: Copy index text page
template:
src: "files/index.html.j2"
dest: "/var/www/html/index.html"
![](https://tungle.ca/wp-content/uploads/2022/01/image-513.png)
Add Debian server with corresponding IP address information on hosts file.
![](https://tungle.ca/wp-content/uploads/2022/01/image-514.png)
Go to /etc/ansible directory and create a new files directory.
#pwd /etc/ansible
sudo mkdir files
sudo touch index.html.j2 && sudo nano index.html.j2
<html>
<head>
<title>{{ firstname}} - {{ lastname }}</title>
</head>
<body>
<h1>{{ firstname }} - {{ lastname }}</h1>
<h3>Welcome to Tung's Ansbile Test Page</h3>
<img src="http://imagefromtheinternet.jpg">
</body>
</html>
![](https://tungle.ca/wp-content/uploads/2022/01/image-515-1024x181.png)
Run ansible-playbook to install apache webserver on remote Debian Linux server.
ansible-playbook -i /etc/ansible/hosts tungapache.yaml -u root
![](https://tungle.ca/wp-content/uploads/2022/01/image-516-1024x261.png)
Check web content on the Debian server.
http://192.168.5.27/index.html
![](https://tungle.ca/wp-content/uploads/2022/01/image-517.png)