Moving all mediaserver tasks to a single playbook

This commit is contained in:
James Tombleson 2019-11-04 06:35:24 -08:00
parent 2aa633d884
commit 7cd173afcb
3 changed files with 102 additions and 57 deletions

View File

@ -1,6 +1,13 @@
- name: Configure Media Server - name: Configure Media Server
hosts: mediaserver hosts: mediaserver
become: yes
vars:
dockerFolder: "/docker"
dockerMount: "/docker/config"
dockerPlex: "/docker/plex"
nfsAddress: 192.168.0.16
dockerNetwork: mediaserver
tasks: tasks:
- name: install docker - name: install docker
@ -10,24 +17,34 @@
- name: make docker folder location - name: make docker folder location
file: file:
path: /docker path: "{{ dockerFolder }}"
state: directory state: directory
become: yes
- name: make docker config path - name: make docker config path
file: file:
path: /docker/config path: "{{ dockerMount }}"
state: directory state: directory
become: yes
- name: mount nfs to /docker/config - name: mount nfs to /docker/config
mount: mount:
src: "192.168.0.16:/docker/" src: "{{ nfsAddress }}:/docker/"
path: /docker/config 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 }}"
fstype: nfs fstype: nfs
boot: yes boot: yes
state: mounted state: mounted
become: yes
- name: install docker pip package - name: install docker pip package
pip: pip:
@ -37,6 +54,81 @@
- name: make docker network - name: make docker network
docker_network: docker_network:
- name: mediaserver 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 }}"

View File

@ -1,21 +1,4 @@
--- ---
# fstab info
mount_user: !vault |
$ANSIBLE_VAULT;1.1;AES256
38316431326133336166313838623232393765323137363737333161623262653632656664306266
3963633932616139616563386232323062623632313131620a613962623932303838663639373038
39333063363265616366343636366565386236626339663763323761363035623730333437646432
3463373232326334370a333033326637366534356430376637363861663133633634373832303032
6634
mount_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256
37353436303838363038343639306636636165663335346166353133633935613235306235386336
3932313964333232333963623331373838393163616231320a323037653564303138633930323961
38646632663661616338643462346238363265323535383639616166396434663536626361663331
3166626638316561630a643465633938346431336430613235653465626231353831303961396134
3231
# Volumes # Volumes
sonarr_data: sonarr_data sonarr_data: sonarr_data
sonarr_config: sonarr_config sonarr_config: sonarr_config

View File

@ -1,30 +0,0 @@
---
all:
hosts:
dmi-dev01:
children:
linux:
hosts:
172.20.0.142:
vars:
ansible_user: ansible
ansible_connection: ssh
ansible_password:
ansible_become_method: sudo
ansible_become_pass:
ansible_python_interpreter: /usr/bin/python3
windows:
hosts:
dev01:
vars:
ansible_user: ansible
ansible_password:
ansible_connection: winrm
ansible_port: 5985
ansible_winrm_scheme: http
ansible_winrm_transport: ntlm
ansible_winrm_server_cert_validation: ignore
osx:
hosts:
127.0.0.1