2019-11-03 21:46:19 -08:00
|
|
|
|
|
|
|
- name: Configure Media Server
|
|
|
|
hosts: mediaserver
|
2019-11-04 06:35:24 -08:00
|
|
|
become: yes
|
|
|
|
vars:
|
|
|
|
dockerFolder: "/docker"
|
|
|
|
dockerMount: "/docker/config"
|
|
|
|
dockerPlex: "/docker/plex"
|
|
|
|
nfsAddress: 192.168.0.16
|
|
|
|
dockerNetwork: mediaserver
|
2019-11-03 21:46:19 -08:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: install docker
|
|
|
|
import_role:
|
|
|
|
name: geerlingguy.docker
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: make docker folder location
|
|
|
|
file:
|
2019-11-04 06:35:24 -08:00
|
|
|
path: "{{ dockerFolder }}"
|
2019-11-03 21:46:19 -08:00
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: make docker config path
|
|
|
|
file:
|
2019-11-04 06:35:24 -08:00
|
|
|
path: "{{ dockerMount }}"
|
2019-11-03 21:46:19 -08:00
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: mount nfs to /docker/config
|
|
|
|
mount:
|
2019-11-04 06:35:24 -08:00
|
|
|
src: "{{ nfsAddress }}:/docker/"
|
|
|
|
path: "{{ dockerMount }}"
|
|
|
|
fstype: nfs
|
|
|
|
boot: yes
|
|
|
|
state: mounted
|
|
|
|
|
|
|
|
- name: make plex mount point
|
|
|
|
file:
|
|
|
|
path: "{{ dockerPlex }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: mount nfs to /docker/plex
|
|
|
|
mount:
|
|
|
|
src: "{{nfsAddress }}:/plex/"
|
|
|
|
path: "{{ dockerPlex }}"
|
2019-11-03 21:46:19 -08:00
|
|
|
fstype: nfs
|
|
|
|
boot: yes
|
|
|
|
state: mounted
|
|
|
|
|
|
|
|
- name: install docker pip package
|
|
|
|
pip:
|
|
|
|
name: docker
|
|
|
|
state: present
|
|
|
|
executable: pip3
|
|
|
|
|
|
|
|
- name: make docker network
|
|
|
|
docker_network:
|
2019-11-04 06:35:24 -08:00
|
|
|
name: "{{ dockerNetwork }}"
|
|
|
|
|
|
|
|
- name: stop hydra
|
|
|
|
docker_container:
|
|
|
|
name: hydra
|
|
|
|
state: stopped
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Make Hydra
|
|
|
|
docker_container:
|
|
|
|
name: hydra
|
|
|
|
image: 'linuxserver/hydra2:latest'
|
|
|
|
state: started
|
|
|
|
env:
|
|
|
|
#PUID=1000
|
|
|
|
#PGID=1000
|
|
|
|
PUID=0
|
|
|
|
PGID=0
|
|
|
|
TZ=Europe/London
|
|
|
|
ports:
|
|
|
|
- 5076:5076
|
|
|
|
volumes:
|
|
|
|
#- "{{ hydra_config }}:/config"
|
|
|
|
- "{{ dockerMount }}/hydra:/config"
|
|
|
|
- "/docker/downloads:/downloads"
|
|
|
|
networks:
|
|
|
|
- name: "{{ dockerNetwork }}"
|
|
|
|
|
|
|
|
- name: stop sonarr
|
|
|
|
docker_container:
|
|
|
|
name: sonarr
|
|
|
|
state: stopped
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: start sonarr
|
|
|
|
docker_container:
|
|
|
|
name: sonarr
|
|
|
|
image: linuxserver/sonarr:latest
|
|
|
|
state: started
|
|
|
|
env:
|
|
|
|
# Use 0 because this runs as root
|
|
|
|
#PUID=1000
|
|
|
|
#PGID=1000
|
|
|
|
PUID=0
|
|
|
|
PGID=0
|
|
|
|
TZ=Europe/London
|
|
|
|
UMASK_SET=022 #optional
|
|
|
|
ports:
|
|
|
|
- 8989:8989
|
|
|
|
volumes:
|
|
|
|
- "{{ dockerMount }}/sonarr/config:/config"
|
|
|
|
- "/docker/sonarr/data:/tv"
|
|
|
|
- "/docker/downloads:/downloads"
|
|
|
|
networks:
|
|
|
|
- name: "{{ dockerNetwork }}"
|
|
|
|
|
|
|
|
- name: stop nzb
|
|
|
|
docker_container:
|
|
|
|
name: nzbget
|
|
|
|
state: stopped
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Make Nzb
|
|
|
|
docker_container:
|
|
|
|
name: nzbget
|
|
|
|
image: linuxserver/nzbget:latest
|
|
|
|
state: started
|
|
|
|
env:
|
|
|
|
PUID=0
|
|
|
|
PGID=0
|
|
|
|
TZ=Europe/London
|
|
|
|
ports:
|
|
|
|
- 6789:6789
|
|
|
|
volumes:
|
|
|
|
- "{{ dockerMount }}/nzbget:/config"
|
|
|
|
- "/docker/downloads:/downloads"
|
|
|
|
networks:
|
|
|
|
- name: "{{ dockerNetwork }}"
|