This commit is contained in:
commit
98db1a8d77
41
.drone.yml
Normal file
41
.drone.yml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: mediaserver
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check syntax
|
||||||
|
image: plugins/ansible:1
|
||||||
|
environment:
|
||||||
|
cifs_username:
|
||||||
|
from_secret: cifs_username
|
||||||
|
cifs_password:
|
||||||
|
from_secret: cifs_password
|
||||||
|
settings:
|
||||||
|
playbook: playbook.yml
|
||||||
|
inventory: inventory.yml
|
||||||
|
galaxy: requirements.yml
|
||||||
|
syntax_check: true
|
||||||
|
|
||||||
|
- name: Apply playbook
|
||||||
|
image: plugins/ansible:1
|
||||||
|
environment:
|
||||||
|
cifs_username:
|
||||||
|
from_secret: cifs_username
|
||||||
|
cifs_password:
|
||||||
|
from_secret: cifs_password
|
||||||
|
volumes:
|
||||||
|
- name: certificates
|
||||||
|
path: /certificates
|
||||||
|
settings:
|
||||||
|
playbook: playbook.yml
|
||||||
|
inventory: inventory.yml
|
||||||
|
galaxy: requirements.yml
|
||||||
|
private_key:
|
||||||
|
from_secret: ssh_privatekey
|
||||||
|
# vault_password:
|
||||||
|
# from_secret: ansible_vault_password
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: certificates
|
||||||
|
claim:
|
||||||
|
name: flexvolsmb-drone-certs
|
6
inventory.yml
Normal file
6
inventory.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
all:
|
||||||
|
children:
|
||||||
|
mediaserver:
|
||||||
|
hosts:
|
||||||
|
bv11-pvr:
|
||||||
|
ansible_host: bv11-pvr.bessems.lan
|
7
playbook.yml
Normal file
7
playbook.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- hosts: mediaserver
|
||||||
|
remote_user: root
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- dockerhost
|
||||||
|
- mediaserver
|
2
requirements.yml
Normal file
2
requirements.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
collections:
|
||||||
|
- community.docker
|
77
roles/dockerhost/tasks/main.yml
Normal file
77
roles/dockerhost/tasks/main.yml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
- name: Remove undesired packages
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- containerd
|
||||||
|
- docker
|
||||||
|
- docker-engine
|
||||||
|
- docker.io
|
||||||
|
- runc
|
||||||
|
- snapd
|
||||||
|
state: absent
|
||||||
|
autoremove: yes
|
||||||
|
purge: yes
|
||||||
|
|
||||||
|
- name: Install prereqs for custom apt repository over https
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
name:
|
||||||
|
- apt-transport-https
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- gnupg-agent
|
||||||
|
- software-properties-common
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add Docker repo key
|
||||||
|
apt_key:
|
||||||
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||||||
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Determine Ubuntu distribution name
|
||||||
|
command: lsb_release -cs
|
||||||
|
register: releasename
|
||||||
|
|
||||||
|
- name: Add Docker apt repository
|
||||||
|
apt_repository:
|
||||||
|
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ releasename.stdout }} stable
|
||||||
|
state: present
|
||||||
|
|
||||||
|
# # Pinning versions due to odd DNS issue in 20.x
|
||||||
|
# - name: Pin Docker engine to specific version
|
||||||
|
# copy:
|
||||||
|
# dest: "{{ item.dest }}"
|
||||||
|
# content: "{{ item.content }}"
|
||||||
|
# with_items:
|
||||||
|
# - dest: /etc/apt/preferences.d/docker-ce
|
||||||
|
# content: |
|
||||||
|
# Package: docker-ce
|
||||||
|
# Pin: version 5:19.03.13~3-0~ubuntu-focal
|
||||||
|
# Pin-Priority: 1001
|
||||||
|
# - dest: /etc/apt/preferences.d/docker-ce-cli
|
||||||
|
# content: |
|
||||||
|
# Package: docker-ce-cli
|
||||||
|
# Pin: version 5:19.03.13~3-0~ubuntu-focal
|
||||||
|
# Pin-Priority: 1001
|
||||||
|
|
||||||
|
- name: Install Docker engine
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
allow_unauthenticated: yes
|
||||||
|
name:
|
||||||
|
# - docker-ce=5:19.03.13~3-0~ubuntu-focal
|
||||||
|
# - docker-ce-cli=5:19.03.13~3-0~ubuntu-focal
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
|
||||||
|
- name: Install Docker Compose
|
||||||
|
get_url:
|
||||||
|
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
|
||||||
|
dest: /usr/local/bin/docker-compose
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Add Docker Compose to path
|
||||||
|
command: ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||||
|
args:
|
||||||
|
creates: /usr/bin/docker-compose
|
37
roles/mediaserver/tasks/main.yml
Normal file
37
roles/mediaserver/tasks/main.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
- name: Create Docker volumes
|
||||||
|
community.docker.docker_volume:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
driver: local
|
||||||
|
driver_options:
|
||||||
|
type: cifs
|
||||||
|
o: "username=<removed>,password=<removed>,domain=bessems.eu,file_mode=0777,dir_mode=0777,iocharset=utf8"
|
||||||
|
device: "//192.168.11.225/{{ item.path }}"
|
||||||
|
loop:
|
||||||
|
- name: cifs_books
|
||||||
|
path: Public/Boeken
|
||||||
|
- name: cifs_photos
|
||||||
|
path: Public/Foto's
|
||||||
|
- name: cifs_videos-series
|
||||||
|
path: Public/Video's/Series
|
||||||
|
- name: cifs_videos-films
|
||||||
|
path: Public/Video's/Films
|
||||||
|
- name: cifs_songs
|
||||||
|
path: Public/Audio/DeSchakel
|
||||||
|
|
||||||
|
- name: Start Plex container
|
||||||
|
community.docker.docker_container:
|
||||||
|
name: Plex
|
||||||
|
image: linuxserver/plex
|
||||||
|
network_mode: host
|
||||||
|
env:
|
||||||
|
VERSION: latest
|
||||||
|
volumes:
|
||||||
|
- /root/containers/pvr/plex/config:/config
|
||||||
|
- cifs_photos:/data/photos
|
||||||
|
- cifs_video-films:/data/movies
|
||||||
|
- cifs_video-series:/data/series
|
||||||
|
command: sleep 1d
|
||||||
|
register: output
|
||||||
|
|
||||||
|
- ansible.builtin.debug:
|
||||||
|
var: output
|
Loading…
Reference in New Issue
Block a user