Adds ansible playbook for foundry setup

Currently, running the playbook will:
- Install dependencies (Caddy, nodejs, unzip)
- Create a foundry user
- Extract foundry app into folder on server
- Update Caddyfile with reverse proxt config

TODO:
- unit file for foundry itself
- data directory
This commit is contained in:
David Underwood
2021-03-10 11:48:54 -05:00
commit ca55c88ac4
4 changed files with 60 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
# Don't check in the foundry app itself
foundryvtt.zip
# Or the variables file
variables.yml

3
Caddyfile.j2 Normal file
View File

@@ -0,0 +1,3 @@
{{ domain_name }}
reverse_proxy localhost:30000

51
foundry_playbook.yml Normal file
View File

@@ -0,0 +1,51 @@
---
- name: Fountry VTT installation
hosts: all
remote_user: root
vars_files:
- ./variables.yml
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: Dependencies
apt:
update_cache: yes
pkg:
- unzip
- nodejs
- caddy
- name: Foundry group
group:
name: foundry
state: present
- name: Foundry user
user:
name: foundry
group: foundry
shell: /bin/bash
- name: Foundry install directory
file:
path: /home/foundry/foundry_app
state: directory
owner: foundry
group: foundry
mode: '0644'
- name: Foundry archive
unarchive:
src: ./foundryvtt.zip
dest: /home/foundry/foundry_app
owner: foundry
group: foundry
mode: '0644'
- name: Caddyfile
template:
src: ./Caddyfile.j2
dest: /etc/caddy/Caddyfile
owner: root
group: root
mode: '0644'

1
variables.yml.example Normal file
View File

@@ -0,0 +1 @@
domain_name: vtt.vidja.social