Add playbooks/apache.yml

This commit is contained in:
2026-06-13 13:39:38 +01:00
parent 7d73a3896d
commit a938474d5b

56
playbooks/apache.yml Normal file
View File

@@ -0,0 +1,56 @@
- name: install required software
hosts: apache-intranet
become: yes
tasks:
- name: install apache
apt:
name:
- apache2
state: present
update_cache: yes
- name: create intranet directory
file:
path: /var/www/intranet
state: directory
owner: root
group: root
mode: 0755
- name: create files directory
file:
path: /var/www/files
state: directory
owner: jigglypuff
group: jigglypuff
mode: 0755
- name: install apache config
template:
src: ../configs/apache.j2
dest: /etc/apache2/sites-available/000-default.conf
owner: root
group: root
mode: 0644
- name: copy the index file
copy:
src: ../configs/index.html
dest: /var/www/intranet
owner: root
group: root
mode: 0644
- name: copy the favourite icon
copy:
src: ../configs/favicon.ico
dest: /var/www/intranet
owner: root
group: root
mode: 0644
- name: restart apache
ansible.builtin.systemd:
name: apache2
state: restarted