Use Ansible for uploading files and managing NGINX

This commit is contained in:
Oliver Davies 2024-05-03 21:40:02 +01:00
parent 45e8206df8
commit cd6575c6fc
7 changed files with 489 additions and 3 deletions

18
tools/ansible/deploy.yaml Normal file
View file

@ -0,0 +1,18 @@
---
- hosts: all
vars:
project_dir: /srv/www.oliverdavies.uk
tasks:
- ansible.builtin.file:
path: "{{ project_dir }}"
state: directory
owner: opdavies
group: opdavies
become: true
- ansible.builtin.synchronize:
src: ../../output_prod/
dest: "{{ project_dir }}"
delete: true

1
tools/ansible/hosts.ini Normal file
View file

@ -0,0 +1 @@
ssh.oliverdavies.uk

View file

@ -0,0 +1,16 @@
---
- hosts: all
become: true
vars:
domain: www.oliverdavies.uk
tasks:
- ansible.builtin.copy:
src: ../nginx/{{ domain }}.conf
dest: /etc/nginx/sites-available/{{ domain }}.conf
- ansible.builtin.file:
src: /etc/nginx/sites-available/{{ domain }}.conf
dest: /etc/nginx/sites-enabled/{{ domain }}.conf
state: link