From 7cd173afcb88db54c41f98ed883839fefdd7a97b Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Mon, 4 Nov 2019 06:35:24 -0800 Subject: [PATCH] Moving all mediaserver tasks to a single playbook --- playbook/docker/mediaserver/mediaserver.yml | 112 ++++++++++++++++++-- playbook/docker/mediaserver/vars.yml | 17 --- test.yaml | 30 ------ 3 files changed, 102 insertions(+), 57 deletions(-) delete mode 100644 test.yaml diff --git a/playbook/docker/mediaserver/mediaserver.yml b/playbook/docker/mediaserver/mediaserver.yml index 2fcbaff..1a576e1 100644 --- a/playbook/docker/mediaserver/mediaserver.yml +++ b/playbook/docker/mediaserver/mediaserver.yml @@ -1,6 +1,13 @@ - name: Configure Media Server hosts: mediaserver + become: yes + vars: + dockerFolder: "/docker" + dockerMount: "/docker/config" + dockerPlex: "/docker/plex" + nfsAddress: 192.168.0.16 + dockerNetwork: mediaserver tasks: - name: install docker @@ -10,24 +17,34 @@ - name: make docker folder location file: - path: /docker + path: "{{ dockerFolder }}" state: directory - become: yes - name: make docker config path file: - path: /docker/config + path: "{{ dockerMount }}" state: directory - become: yes - name: mount nfs to /docker/config mount: - src: "192.168.0.16:/docker/" - path: /docker/config + 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 }}" fstype: nfs boot: yes state: mounted - become: yes - name: install docker pip package pip: @@ -37,6 +54,81 @@ - name: make docker network docker_network: - - name: mediaserver - - \ No newline at end of file + 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 }}" \ No newline at end of file diff --git a/playbook/docker/mediaserver/vars.yml b/playbook/docker/mediaserver/vars.yml index 156a5cc..f9b6e10 100644 --- a/playbook/docker/mediaserver/vars.yml +++ b/playbook/docker/mediaserver/vars.yml @@ -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 sonarr_data: sonarr_data sonarr_config: sonarr_config diff --git a/test.yaml b/test.yaml deleted file mode 100644 index 54d459b..0000000 --- a/test.yaml +++ /dev/null @@ -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 -