rice/docker-host/setup/tasks/nginx.yml

78 lines
1.6 KiB
YAML
Raw Normal View History

---
- 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
- name: Ensure the default website is disabled
file:
path: /etc/nginx/sites-enabled/default
state: absent
- 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:
src: "{{ item }}"
2022-01-24 03:16:23 +00:00
dest: /etc/nginx/sites-available/
loop:
- ../files/git.lablad
2022-04-04 05:21:33 +00:00
- ../files/music.lablad
- ../files/files.lablad
- ../files/metrics.lablad
- ../files/todo.lablad
- ../files/home.lablad
- ../files/vault.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:
- git.lablad
2022-04-04 05:21:33 +00:00
- music.lablad
- files.lablad
- metrics.lablad
- vault.lablad
- todo.lablad
- home.lablad
2022-01-24 03:16:23 +00:00
notify:
- restart-nginx
handlers:
- import_tasks: ../handlers/nginx.yml