josiah
1b3f2a1e6d
That nfs volume mount is not needed now that I figured out how to do LVM expansion within Proxmox. Still more to figure out, but for now this is great.
109 lines
2.7 KiB
YAML
109 lines
2.7 KiB
YAML
---
|
|
# deploy a media server from scratch.
|
|
|
|
# boot strap server
|
|
- name: Install aptitude using apt
|
|
apt: name=aptitude state=latest update_cache=yes force_apt_get=yes
|
|
|
|
- name: Install required system packages for docker install
|
|
apt: name={{ item }} state=latest update_cache=yes
|
|
loop: [ 'apt-transport-https', 'ca-certificates', 'software-properties-common' ]
|
|
|
|
- name: Add Docker GPG apt Key
|
|
apt_key:
|
|
url: https://download.docker.com/linux/debian/gpg
|
|
state: present
|
|
|
|
- name: Add Docker Repository
|
|
apt_repository:
|
|
repo: deb https://download.docker.com/linux/ubuntu bionic stable
|
|
state: present
|
|
|
|
- name: Update apt
|
|
apt: update_cache=yes
|
|
|
|
- name: Install required system packages
|
|
apt: name={{ sys_packages }} state=latest
|
|
|
|
- name: add 'josiah' to docker group
|
|
user:
|
|
name='josiah'
|
|
groups=docker
|
|
append=yes
|
|
|
|
# TODO: Partition, detect PV, add new disk to LVM.
|
|
|
|
- name: Mount usenet volume
|
|
ansible.posix.mount:
|
|
src: storage.home.jowj.net:/volume1/usenet
|
|
path: /media/usenet
|
|
opts: rw,sync,hard
|
|
state: mounted
|
|
fstype: nfs
|
|
|
|
- name: Init a new swarm with default parameters
|
|
community.general.docker_swarm:
|
|
state: present
|
|
|
|
# set up mediaserver specific bullshit.
|
|
- name: ensure app dir exists
|
|
file:
|
|
path: /home/josiah/apps/
|
|
state: directory
|
|
recurse: yes
|
|
owner: josiah
|
|
group: josiah
|
|
|
|
- name: ensure app config directory exists
|
|
file:
|
|
path: /home/josiah/apps/{{ item }}
|
|
state: directory
|
|
recurse: yes
|
|
owner: josiah
|
|
group: josiah
|
|
loop: [ 'traefik', 'hydra2', 'sabnzbd', 'readarr', 'radarr', 'lidarr', 'sonarr', 'bazarr', 'highsea' ]
|
|
|
|
# TODO: Figure out why this doesn't actually create the log if its not present?
|
|
- name: ensure traefik.log exists
|
|
file:
|
|
state: file
|
|
path: /home/josiah/apps/traefik/traefik.log
|
|
|
|
- name: copy over highsea config files
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
with_items:
|
|
- {src: 'highsea-compose.yml', dest: '/home/josiah/apps/highsea/highsea-compose.yml'}
|
|
- {src: 'traefik.yml.j2', dest: '/home/josiah/apps/traefik/traefik.yml'}
|
|
|
|
- name: Ensure acme.json exists
|
|
copy:
|
|
content: ""
|
|
dest: /home/josiah/apps/traefik/acme.json
|
|
force: no
|
|
owner: root
|
|
group: root
|
|
state: file
|
|
mode: '0600'
|
|
|
|
- name: Remove the highsea stack
|
|
block:
|
|
- name: Remove the highsea stack
|
|
docker_stack:
|
|
state: absent
|
|
name: highsea
|
|
compose:
|
|
- /home/josiah/apps/highsea/highsea-compose.yml
|
|
- name: Pause so the network gets deleted too
|
|
pause:
|
|
seconds: 15
|
|
|
|
- name: Deploy highsea stack
|
|
docker_stack:
|
|
state: present
|
|
name: highsea
|
|
prune: yes
|
|
compose:
|
|
- /home/josiah/apps/highsea/highsea-compose.yml
|