docker + fixes
This commit is contained in:
46
roles/common/tasks/docker.yml
Normal file
46
roles/common/tasks/docker.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
- name: Install docker prerequisites
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
|
||||
- name: One way to avoid apt_key once it is removed from your distro
|
||||
block:
|
||||
- name: create keyring folder
|
||||
file:
|
||||
path: /etc/apt/keyrings
|
||||
mode: '0755'
|
||||
recurse: true
|
||||
|
||||
- name: Check if docker key already exists
|
||||
stat:
|
||||
path: /etc/apt/keyrings/docker.gpg
|
||||
register: docker_gpg
|
||||
|
||||
- name: docker repo key
|
||||
shell:
|
||||
cmd: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
when: docker_gpg.stat.exists == false
|
||||
|
||||
- name: add docker repo | apt source
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
|
||||
- name: Install docker
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
update_cache: true
|
||||
loop:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
...
|
||||
@@ -1,4 +1,8 @@
|
||||
---
|
||||
- name: Include docker tasks
|
||||
include_tasks:
|
||||
file: docker.yml
|
||||
|
||||
- name: Create default groups
|
||||
group:
|
||||
name: "{{ item }}"
|
||||
@@ -50,5 +54,29 @@
|
||||
state: present
|
||||
loop:
|
||||
- "{{ default_pkgs }}"
|
||||
|
||||
|
||||
- name: create docker/watchtower folder
|
||||
file:
|
||||
path: /opt/docker/watchtower
|
||||
owner: 1000
|
||||
group: 1000
|
||||
mode: '0755'
|
||||
state: directory
|
||||
|
||||
- name: Place watchtower docker-compose.yaml
|
||||
template:
|
||||
src: docker-compose.yaml.j2
|
||||
dest: /opt/docker/watchtower/docker-compose.yaml
|
||||
#owner: 1000
|
||||
#group: 1000
|
||||
#mode: '0755'
|
||||
notify: restart docker-compose
|
||||
tags: setup,update
|
||||
|
||||
- name: Start watchtower
|
||||
community.docker.docker_compose:
|
||||
project_src: /opt/docker/watchtower
|
||||
state: present
|
||||
pull: true
|
||||
tags: test
|
||||
...
|
||||
|
||||
17
roles/common/templates/docker-compose.yaml.j2
Normal file
17
roles/common/templates/docker-compose.yaml.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
# ansible managed #
|
||||
|
||||
version: '3.3'
|
||||
services:
|
||||
watchtower:
|
||||
image: containrrr/watchtower
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
- WATCHTOWER_SCHEDULE=0 0 4 * * *
|
||||
- WATCHTOWER_CLEANUP=true
|
||||
- WATCHTOWER_TIMEOUT=30s
|
||||
- WATCHTOWER_INCLUDE_RESTARTING=true
|
||||
- WATCHTOWER_ROLLING_RESTART=true
|
||||
- TZ="Europe/Berlin"
|
||||
restart: unless-stopped
|
||||
@@ -73,13 +73,17 @@ sections:
|
||||
icon: favicon
|
||||
url: http://192.168.178.200:9696
|
||||
target: newtab
|
||||
statusCheckUrl: http://192.168.178.200:9696/favicon.ico
|
||||
id: 3_1143_jackett
|
||||
id: 3_1143_prowlarr
|
||||
- title: sabnzbd
|
||||
icon: favicon
|
||||
url: http://192.168.178.200:8080
|
||||
target: newtab
|
||||
id: 4_1143_sabnzbd
|
||||
- title: Jellyfin
|
||||
icon: https://jellyfin.org/favicon.ico
|
||||
icon: favicon
|
||||
url: http://192.168.178.200:8096
|
||||
target: newtab
|
||||
id: 4_1143_jellyfin
|
||||
id: 5_1143_jellyfin
|
||||
displayData:
|
||||
sortBy: default
|
||||
rows: 1
|
||||
@@ -104,14 +108,14 @@ sections:
|
||||
icon: http://192.168.178.201/ui/assets/images/truenas_core_favicon.png
|
||||
url: http://192.168.178.201/ui/
|
||||
id: 1_1041_truenas
|
||||
- title: Seafile
|
||||
icon: https://manual.seafile.com/media/seafile-transparent-1024.png
|
||||
url: http://192.168.178.200:8081
|
||||
id: 2_1041_seafile
|
||||
- title: Django
|
||||
icon: favicon
|
||||
url: http://192.168.178.200:8000
|
||||
id: 3_1041_django
|
||||
# - title: Seafile
|
||||
# icon: https://manual.seafile.com/media/seafile-transparent-1024.png
|
||||
# url: http://192.168.178.200:8081
|
||||
# id: 2_1041_seafile
|
||||
# - title: Django
|
||||
# icon: favicon
|
||||
# url: http://192.168.178.200:8000
|
||||
# id: 3_1041_django
|
||||
- title: check_mk
|
||||
icon: >-
|
||||
http://192.168.178.200:8095/cmk/check_mk/themes/modern-dark/images/tribe29_icon.svg
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
loop:
|
||||
- /opt/docker/mediaserver/config/openvpn
|
||||
- /opt/docker/mediaserver/sabnzbd_config/openvpn
|
||||
changed_when: false
|
||||
tags: setup, delugevpn
|
||||
|
||||
- name: Create dashy config folder
|
||||
|
||||
@@ -175,20 +175,6 @@ services:
|
||||
- 9696:9696
|
||||
restart: unless-stopped
|
||||
|
||||
watchtower:
|
||||
image: containrrr/watchtower
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
- WATCHTOWER_SCHEDULE=0 0 4 * * *
|
||||
- WATCHTOWER_CLEANUP=true
|
||||
- WATCHTOWER_TIMEOUT=30s
|
||||
- WATCHTOWER_INCLUDE_RESTARTING=true
|
||||
- WATCHTOWER_ROLLING_RESTART=true
|
||||
- TZ="Europe/Berlin"
|
||||
restart: unless-stopped
|
||||
|
||||
# readarr:
|
||||
# image: lscr.io/linuxserver/readarr:develop
|
||||
# container_name: readarr
|
||||
|
||||
Reference in New Issue
Block a user