Skip to content

Commit

Permalink
Added media-server deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Hall committed Apr 1, 2020
1 parent aa9043b commit b7360b0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions group_vars/media/vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
upload_user: upload_user
3 changes: 3 additions & 0 deletions hosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ all:
screen2.medianet:
screen3.medianet:
screen4.medianet:
media:
hosts:
media2.medianet:
3 changes: 3 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
- hosts: modular_status
roles:
- status_server
- hosts: media
roles:
- media_server
- hosts: all
roles:
- common
11 changes: 11 additions & 0 deletions roles/media_server/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- name: start media-server container
docker_container:
name: media
image: "raw1251am/media-server:latest"
state: started
env_file: /etc/media-server.env
restart_policy: always
published_ports:
- "8080:8080"
mounts:
- "type=bind,source=/var/www/media-server/media/static,target=/www/media/static"
3 changes: 3 additions & 0 deletions roles/media_server/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- role: geerlingguy.docker
26 changes: 26 additions & 0 deletions roles/media_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- name: ensure pip is installed
apt:
name: python-pip
state: latest
- name: ensure docker pip installed
pip:
name: docker
state: latest

- name: ensure static media directory exists
file:
path: /var/www/media-server/media/static

This comment has been minimized.

Copy link
@connor642

connor642 Apr 1, 2020

Member

Do you think it'd be worth changing path directory to something more obvious? Like /var/media?

state: directory

- name: ensure media-server env file exists
template:
src: media_server.env.j2
dest: /etc/media-server.env
notify: start media-server container
- name: ensure media-server image is latest
docker_image:
name: "raw1251am/media-server:latest"
source: pull
force_source: yes
notify: start media-server container
3 changes: 3 additions & 0 deletions roles/media_server/templates/media_server.env.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPLOAD_USER={{ upload_user }}
UPLOAD_PASSWORD={{ vault_upload_password }}
DISCOGS_API_KEY={{ vault_discogs_api_key}}

0 comments on commit b7360b0

Please sign in to comment.