infra/ansible/playbooks/refresh-nginx.yml

31 lines
786 B
YAML
Raw Normal View History

---
- hosts: webhost
remote_user: root
vars:
websites:
- shockrah.xyz
- git.shockrah.xyz
- temper.tv
- resume.shockrah.xyz
tasks:
- name: Upload configs
copy:
src: "../files/{{ item }}.conf"
dest: "/etc/nginx/sites-available/{{ item }}"
loop: "{{ websites }}"
- name: Enable the site configs with sym links
file:
src: "/etc/nginx/sites-available/{{ item }}"
dest: "/etc/nginx/sites-enabled/{{ item }}"
state: link
loop: "{{ websites }}"
- name: Ensure no default available
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Restart nginx conf to pick up new config changes
service:
name: nginx
state: restarted