2022-01-21 22:48:34 +00:00
|
|
|
---
|
|
|
|
- hosts: leftcoastlab
|
|
|
|
become: yes
|
|
|
|
vars:
|
|
|
|
STATIC_USER: staticweb
|
|
|
|
tasks:
|
|
|
|
- name: Install Nginx Package
|
|
|
|
apt:
|
|
|
|
name: nginx
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Stop Apache2 Service
|
|
|
|
systemd:
|
|
|
|
name: apache2
|
|
|
|
state: stopped
|
|
|
|
enabled: no
|
|
|
|
|
|
|
|
- name: Remove Apache2
|
|
|
|
apt:
|
|
|
|
name: apache2
|
|
|
|
state: absent
|
|
|
|
|
2022-05-01 04:57:00 +00:00
|
|
|
- name: Ensure the default website is disabled
|
|
|
|
file:
|
|
|
|
path: /etc/nginx/sites-enabled/default
|
|
|
|
state: absent
|
|
|
|
|
2022-01-21 22:48:34 +00:00
|
|
|
- name: website user account
|
|
|
|
user:
|
|
|
|
name: "{{STATIC_USER}}"
|
|
|
|
comment: Static Website maintainer account
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create Static web root directory
|
|
|
|
file:
|
|
|
|
path: /var/www
|
|
|
|
state: directory
|
|
|
|
recurse: yes
|
|
|
|
owner: "{{STATIC_USER}}"
|
|
|
|
group: "{{STATIC_USER}}"
|
2022-01-24 03:16:23 +00:00
|
|
|
|
|
|
|
- name: Copy Reverse proxy configs
|
|
|
|
copy:
|
2022-01-24 20:05:44 +00:00
|
|
|
src: "{{ item }}"
|
2022-01-24 03:16:23 +00:00
|
|
|
dest: /etc/nginx/sites-available/
|
|
|
|
loop:
|
2022-02-14 01:16:30 +00:00
|
|
|
- ../files/git.lablad
|
2022-04-04 05:21:33 +00:00
|
|
|
- ../files/music.lablad
|
|
|
|
- ../files/files.lablad
|
2022-04-15 03:43:10 +00:00
|
|
|
- ../files/metrics.lablad
|
2022-05-01 04:55:05 +00:00
|
|
|
- ../files/todo.lablad
|
2022-05-01 04:57:00 +00:00
|
|
|
- ../files/home.lablad
|
2022-01-24 03:16:23 +00:00
|
|
|
|
|
|
|
- name: Enable Sites
|
|
|
|
file:
|
|
|
|
src: /etc/nginx/sites-available/{{item}}
|
|
|
|
dest: /etc/nginx/sites-enabled/{{item}}
|
|
|
|
state: link
|
|
|
|
loop:
|
2022-02-14 01:16:30 +00:00
|
|
|
- git.lablad
|
2022-04-04 05:21:33 +00:00
|
|
|
- music.lablad
|
|
|
|
- files.lablad
|
2022-04-15 03:43:10 +00:00
|
|
|
- metrics.lablad
|
2022-05-01 04:55:05 +00:00
|
|
|
- todo.lablad
|
2022-05-01 04:57:00 +00:00
|
|
|
- home.lablad
|
2022-01-24 03:16:23 +00:00
|
|
|
notify:
|
|
|
|
- restart-nginx
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
- import_tasks: ../handlers/nginx.yml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|