Finishes todos for proper service creation

This commit is contained in:
David Underwood
2021-03-10 21:14:55 -05:00
parent 302c31bfca
commit 54dbba3b35
3 changed files with 74 additions and 20 deletions

View File

@@ -7,11 +7,22 @@
environment:
DATA_DIRECTORY: /home/foundry/data
tasks:
- name: Apt repos
shell: |
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
- name: Node GPG keys
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Caddy GPG keys
apt_key:
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
state: present
- name: Node apt repo
apt_repository:
repo: deb https://deb.nodesource.com/node_14.x focal main
state: present
- name: Caddy apt repo
apt_repository:
repo: deb https://dl.cloudsmith.io/public/caddy/stable/deb/ubuntu focal main
state: present
- name: Dependencies
apt:
update_cache: yes
@@ -34,18 +45,50 @@
state: directory
owner: foundry
group: foundry
mode: '0644'
- name: Foundry archive
unarchive:
src: ./foundryvtt.zip
dest: /home/foundry/foundry_app
mode: '0744'
- name: Foundry data directory
file:
path: /home/foundry/foundry_data
state: directory
owner: foundry
group: foundry
mode: '0644'
mode: '0744'
- name: Foundry archive
copy:
src: ./foundryvtt.zip
dest: /home/foundry/foundryvtt.zip
owner: foundry
group: foundry
mode: '0744'
register: foundry_archive
- name: Foundry extract
unarchive:
src: /home/foundry/foundryvtt.zip
dest: /home/foundry/foundry_app
remote_src: yes
owner: foundry
group: foundry
mode: '0744'
when: foundry_archive.changed
- name: Caddyfile
template:
src: ./Caddyfile.j2
dest: /etc/caddy/Caddyfile
owner: root
group: root
mode: '0644'
owner: caddy
group: caddy
mode: '0744'
- name: Foundry unit file
copy:
src: ./foundryvtt.service
dest: /etc/systemd/system/foundryvtt.service
- name: Refresh systemd
systemd:
daemon_reload: yes
- name: Foundry service
systemd:
name: foundryvtt.service
state: restarted
- name: Caddy service
systemd:
name: caddy.service
state: restarted