diff --git a/nas.yml b/nas.yml
index a453b0b7..4d30a93f 100644
--- a/nas.yml
+++ b/nas.yml
@@ -123,12 +123,10 @@
- role: freshrss
tags:
- freshrss
- when: (freshrss_enabled | default(False))
- role: get_iplayer
tags:
- get_iplayer
- when: (get_iplayer_enabled | default(False))
- role: gitea
tags:
@@ -137,32 +135,26 @@
- role: gitlab
tags:
- gitlab
- when: (gitlab_enabled | default(False))
- role: glances
tags:
- glances
- when: (glances_enabled | default(False))
- role: gotify
tags:
- gotify
- when: (gotify_enabled | default(False))
- role: guacamole
tags:
- guacamole
- when: (guacamole_enabled | default(False))
- role: healthchecks.io
tags:
- healthchecks.io
- when: (healthchecks_enabled | default(False))
- role: heimdall
tags:
- heimdall
- when: (heimdall_enabled | default(False))
- role: hello_world
tags:
@@ -171,67 +163,54 @@
- role: homeassistant
tags:
- homeassistant
- when: (homeassistant_enabled | default(False))
- role: homebridge
tags:
- homebridge
- when: (homebridge_enabled | default(False))
- role: jackett
tags:
- jackett
- when: (jackett_enabled | default(False))
- role: jellyfin
tags:
- jellyfin
- when: (jellyfin_enabled | default(False))
- role: joomla
tags:
- joomla
- when: (joomla_enabled | default(False))
- role: komga
tags:
- komga
- when: (komga_enabled | default(False))
- role: krusader
tags:
- krusader
- when: (krusader_enabled | default(False))
- role: lidarr
tags:
- lidarr
- when: (lidarr_enabled | default(False))
- role: mealie
tags:
- mealie
- when: (mealie_enabled | default(False))
- role: minecraft-server
tags:
- minecraft-server
- when: (minecraft_server_enabled | default(False))
- role: minidlna
tags:
- minidlna
- when: (minidlna_enabled | default(False))
- role: miniflux
tags:
- miniflux
- when: (miniflux_enabled | default(False))
- role: mosquitto
tags:
- mosquitto
- when: (mosquitto_enabled | default(False))
- role: mumble
tags:
@@ -240,37 +219,30 @@
- role: mylar
tags:
- mylar
- when: (mylar_enabled | default(False))
- role: mymediaforalexa
tags:
- mymediaforalexa
- when: (mymediaforalexa_enabled | default(False))
- role: n8n
tags:
- n8n
- when: (n8n_enabled | default(False))
- role: navidrome
tags:
- navidrome
- when: (navidrome_enabled | default(False))
- role: netbootxyz
tags:
- netbootxyz
- when: (netbootxyz_enabled | default(False))
- role: netdata
tags:
- netdata
- when: (netdata_enabled | default(False))
- role: nextcloud
tags:
- nextcloud
- when: (nextcloud_enabled | default(False))
- role: nomad
tags:
@@ -279,189 +251,151 @@
- role: nzbget
tags:
- nzbget
- when: (nzbget_enabled | default(False))
- role: octoprint
tags:
- octoprint
- when: (octoprint_enabled | default(False))
- role: ombi
tags:
- ombi
- when: (ombi_enabled | default(False))
- role: openhab
tags:
- openhab
- when: (openhab_enabled | default(False))
- role: organizr
tags:
- organizr
- when: (organizr_enabled | default(False))
- role: overseerr
tags:
- overseerr
- when: (overseerr_enabled | default(False))
- role: paperless_ng
tags:
- paperless_ng
- when: (paperless_ng_enabled | default(False))
- role: piwigo
tags:
- piwigo
- when: (piwigo_enabled | default(False))
- role: plex
tags:
- plex
- when: (plex_enabled | default(False))
- role: portainer
tags:
- portainer
- when: (portainer_enabled | default(False))
- role: prowlarr
tags:
- prowlarr
- when: (prowlarr_enabled | default(False))
- role: pyload
tags:
- pyload
- when: (pyload_enabled | default(False))
- role: pytivo
tags:
- pytivo
- when: (pytivo_enabled | default(False))
- role: radarr
tags:
- radarr
- when: (radarr_enabled | default(False))
- role: route53_ddns
tags:
- route53_ddns
- when: (route53_ddns_enabled | default(False))
- role: rssbridge
tags:
- rssbridge
- when: (rssbridge_enabled | default(False))
- role: sabnzbd
tags:
- sabnzbd
- when: (sabnzbd_enabled | default(False))
- role: sickchill
tags:
- sickchill
- when: (sickchill_enabled | default(False))
- role: sonarr
tags:
- sonarr
- when: (sonarr_enabled | default(False))
- role: speedtest-tracker
tags:
- speedtest-tracker
- when: (speedtest_tracker_enabled | default(False))
- role: stats
tags:
- stats
- when: (stats_enabled | default(False))
- role: syncthing
tags:
- syncthing
- when: (syncthing_enabled | default(False))
- role: tautulli
tags:
- tautulli
- when: (tautulli_enabled | default(False))
- role: thelounge
tags:
- thelounge
- when: (thelounge_enabled | default(False))
- role: tiddlywiki
tags:
- tiddlywiki
- when: (tiddlywiki_enabled | default(False))
- role: timemachine
tags:
- timemachine
- when: (timemachine_enabled | default(False))
- role: traefik
tags:
- traefik
- when: (traefik_enabled | default(False))
- role: transmission
tags:
- transmission
- when: (transmission_enabled | default(False))
- role: transmission-with-openvpn
tags:
- transmission_with_openvpn
- when: (transmission_with_openvpn_enabled | default(False))
- role: ubooquity
tags:
- ubooquity
- when: (ubooquity_enabled | default(False))
- role: utorrent
tags:
- utorrent
- when: (utorrent_enabled | default(False))
- role: virtual_desktop
tags:
- virtual_desktop
- when: (virtual_desktop_enabled | default(False))
- role: wallabag
tags:
- wallabag
- when: (wallabag_enabled | default(False))
- role: watchtower
tags:
- watchtower
- when: (watchtower_enabled | default(False))
- role: wireshark
tags:
- wireshark
- when: (wireshark_enabled | default(False))
- role: woodpecker-ci
tags:
- woodpecker_ci
- when: (woodpecker_ci_enabled | default(False))
- role: youtubedlmaterial
tags:
- youtubedlmaterial
- when: (youtubedlmaterial_enabled | default(False))
- role: znc
tags:
- znc
- when: (znc_enabled | default(False))
diff --git a/roles/airsonic/molecule/default/verify.yml b/roles/airsonic/molecule/default/verify.yml
index 5dc0a7c4..4b3472e7 100644
--- a/roles/airsonic/molecule/default/verify.yml
+++ b/roles/airsonic/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/airsonic/molecule/default/verify_stopped.yml b/roles/airsonic/molecule/default/verify_stopped.yml
index a6420557..2a42b6dd 100644
--- a/roles/airsonic/molecule/default/verify_stopped.yml
+++ b/roles/airsonic/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Airsonic
diff --git a/roles/bazarr/molecule/default/verify.yml b/roles/bazarr/molecule/default/verify.yml
index b2924408..65df9389 100644
--- a/roles/bazarr/molecule/default/verify.yml
+++ b/roles/bazarr/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/bazarr/molecule/default/verify_stopped.yml b/roles/bazarr/molecule/default/verify_stopped.yml
index 7b316fdb..a82a3746 100644
--- a/roles/bazarr/molecule/default/verify_stopped.yml
+++ b/roles/bazarr/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Bazarr
diff --git a/roles/bitwarden/molecule/default/verify.yml b/roles/bitwarden/molecule/default/verify.yml
index c62702be..797499d0 100644
--- a/roles/bitwarden/molecule/default/verify.yml
+++ b/roles/bitwarden/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/bitwarden/molecule/default/verify_stopped.yml b/roles/bitwarden/molecule/default/verify_stopped.yml
index debe8358..ca08d064 100644
--- a/roles/bitwarden/molecule/default/verify_stopped.yml
+++ b/roles/bitwarden/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Bitwarden
diff --git a/roles/booksonic/molecule/default/verify.yml b/roles/booksonic/molecule/default/verify.yml
index 98400317..145ab469 100644
--- a/roles/booksonic/molecule/default/verify.yml
+++ b/roles/booksonic/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/booksonic/molecule/default/verify_stopped.yml b/roles/booksonic/molecule/default/verify_stopped.yml
index 7b68fe98..aa5ad018 100644
--- a/roles/booksonic/molecule/default/verify_stopped.yml
+++ b/roles/booksonic/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Booksonic
diff --git a/roles/calibre/molecule/default/verify.yml b/roles/calibre/molecule/default/verify.yml
index 77267b9d..b911fb66 100644
--- a/roles/calibre/molecule/default/verify.yml
+++ b/roles/calibre/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/calibre/molecule/default/verify_stopped.yml b/roles/calibre/molecule/default/verify_stopped.yml
index bd3ccf6e..3ee9c51f 100644
--- a/roles/calibre/molecule/default/verify_stopped.yml
+++ b/roles/calibre/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Calibre
diff --git a/roles/cloudcmd/molecule/default/verify.yml b/roles/cloudcmd/molecule/default/verify.yml
index abef5b4a..14dd662a 100644
--- a/roles/cloudcmd/molecule/default/verify.yml
+++ b/roles/cloudcmd/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/cloudcmd/molecule/default/verify_stopped.yml b/roles/cloudcmd/molecule/default/verify_stopped.yml
index 68ad0d3b..b5beda38 100644
--- a/roles/cloudcmd/molecule/default/verify_stopped.yml
+++ b/roles/cloudcmd/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Cloudcmd
diff --git a/roles/cloudflare_ddns/molecule/default/verify.yml b/roles/cloudflare_ddns/molecule/default/verify.yml
index 0e92e82e..bbcff3a6 100644
--- a/roles/cloudflare_ddns/molecule/default/verify.yml
+++ b/roles/cloudflare_ddns/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/cloudflare_ddns/molecule/default/verify_stopped.yml b/roles/cloudflare_ddns/molecule/default/verify_stopped.yml
index e2273930..ea05fd75 100644
--- a/roles/cloudflare_ddns/molecule/default/verify_stopped.yml
+++ b/roles/cloudflare_ddns/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Cloudflare DDNS
diff --git a/roles/code-server/molecule/default/verify.yml b/roles/code-server/molecule/default/verify.yml
index 970070c6..0abf9488 100644
--- a/roles/code-server/molecule/default/verify.yml
+++ b/roles/code-server/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/code-server/molecule/default/verify_stopped.yml b/roles/code-server/molecule/default/verify_stopped.yml
index 5cba43cc..87973991 100644
--- a/roles/code-server/molecule/default/verify_stopped.yml
+++ b/roles/code-server/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Code Server
diff --git a/roles/couchpotato/molecule/default/verify.yml b/roles/couchpotato/molecule/default/verify.yml
index 3031e902..c4acee8c 100644
--- a/roles/couchpotato/molecule/default/verify.yml
+++ b/roles/couchpotato/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/couchpotato/molecule/default/verify_stopped.yml b/roles/couchpotato/molecule/default/verify_stopped.yml
index 213afef4..f9546dfe 100644
--- a/roles/couchpotato/molecule/default/verify_stopped.yml
+++ b/roles/couchpotato/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Couchpotato
diff --git a/roles/dashy/molecule/default/verify.yml b/roles/dashy/molecule/default/verify.yml
index 6c1bc594..dd68450b 100644
--- a/roles/dashy/molecule/default/verify.yml
+++ b/roles/dashy/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/dashy/molecule/default/verify_stopped.yml b/roles/dashy/molecule/default/verify_stopped.yml
index 1748897f..872ba4f4 100644
--- a/roles/dashy/molecule/default/verify_stopped.yml
+++ b/roles/dashy/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Dashy
diff --git a/roles/deluge/molecule/default/verify.yml b/roles/deluge/molecule/default/verify.yml
index 6d815a89..021229fa 100644
--- a/roles/deluge/molecule/default/verify.yml
+++ b/roles/deluge/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/deluge/molecule/default/verify_stopped.yml b/roles/deluge/molecule/default/verify_stopped.yml
index 9d4abcbe..daa3bbe7 100644
--- a/roles/deluge/molecule/default/verify_stopped.yml
+++ b/roles/deluge/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Deluge
diff --git a/roles/dokuwiki/molecule/default/verify.yml b/roles/dokuwiki/molecule/default/verify.yml
index 676a5e79..d5e4fd9a 100644
--- a/roles/dokuwiki/molecule/default/verify.yml
+++ b/roles/dokuwiki/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/dokuwiki/molecule/default/verify_stopped.yml b/roles/dokuwiki/molecule/default/verify_stopped.yml
index 60151b02..e8101a35 100644
--- a/roles/dokuwiki/molecule/default/verify_stopped.yml
+++ b/roles/dokuwiki/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Dokuwiki
diff --git a/roles/drone-ci/molecule/default/verify.yml b/roles/drone-ci/molecule/default/verify.yml
index c993caf9..f48abc53 100644
--- a/roles/drone-ci/molecule/default/verify.yml
+++ b/roles/drone-ci/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/drone-ci/molecule/default/verify_stopped.yml b/roles/drone-ci/molecule/default/verify_stopped.yml
index 3f8ce56f..3f50b5da 100644
--- a/roles/drone-ci/molecule/default/verify_stopped.yml
+++ b/roles/drone-ci/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Drone CI
diff --git a/roles/duplicacy/molecule/default/verify.yml b/roles/duplicacy/molecule/default/verify.yml
index 7eaee192..e1421406 100644
--- a/roles/duplicacy/molecule/default/verify.yml
+++ b/roles/duplicacy/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/duplicacy/molecule/default/verify_stopped.yml b/roles/duplicacy/molecule/default/verify_stopped.yml
index 487edf70..bf7c63aa 100644
--- a/roles/duplicacy/molecule/default/verify_stopped.yml
+++ b/roles/duplicacy/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Duplicacy
diff --git a/roles/emby/molecule/default/verify.yml b/roles/emby/molecule/default/verify.yml
index ce3037bf..49fb3836 100644
--- a/roles/emby/molecule/default/verify.yml
+++ b/roles/emby/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/esphome/molecule/default/verify.yml b/roles/esphome/molecule/default/verify.yml
index a80b5867..12154f92 100644
--- a/roles/esphome/molecule/default/verify.yml
+++ b/roles/esphome/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/esphome/molecule/default/verify_stopped.yml b/roles/esphome/molecule/default/verify_stopped.yml
index dad14d09..b92cbdd0 100644
--- a/roles/esphome/molecule/default/verify_stopped.yml
+++ b/roles/esphome/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove EspHome
diff --git a/roles/firefly/molecule/default/verify.yml b/roles/firefly/molecule/default/verify.yml
index 7da64ee7..aa387705 100644
--- a/roles/firefly/molecule/default/verify.yml
+++ b/roles/firefly/molecule/default/verify.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/firefly/molecule/default/verify_stopped.yml b/roles/firefly/molecule/default/verify_stopped.yml
index eecb6203..831693bf 100644
--- a/roles/firefly/molecule/default/verify_stopped.yml
+++ b/roles/firefly/molecule/default/verify_stopped.yml
@@ -3,7 +3,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Firefly
diff --git a/roles/freshrss/defaults/main.yml b/roles/freshrss/defaults/main.yml
index a662c442..9dcc3401 100644
--- a/roles/freshrss/defaults/main.yml
+++ b/roles/freshrss/defaults/main.yml
@@ -10,5 +10,10 @@ freshrss_extensions_directory: "{{ docker_home }}/freshrss"
freshrss_port: "8089"
freshrss_hostname: "freshrss"
+# docker
+freshrss_container_name: freshrss
+freshrss_image_name: "freshrss/freshrss"
+freshrss_image_version: latest
+
# specs
freshrss_memory: 1g
diff --git a/roles/freshrss/molecule/default/molecule.yml b/roles/freshrss/molecule/default/molecule.yml
new file mode 100644
index 00000000..76523f3f
--- /dev/null
+++ b/roles/freshrss/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ freshrss_enabled: true
diff --git a/roles/freshrss/molecule/default/side_effect.yml b/roles/freshrss/molecule/default/side_effect.yml
new file mode 100644
index 00000000..da69dc58
--- /dev/null
+++ b/roles/freshrss/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ freshrss_enabled: false
diff --git a/roles/freshrss/molecule/default/verify.yml b/roles/freshrss/molecule/default/verify.yml
new file mode 100644
index 00000000..08aa5cca
--- /dev/null
+++ b/roles/freshrss/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get freshrss container state
+ community.docker.docker_container:
+ name: "{{ freshrss_container_name }}"
+ register: result
+
+ - name: Check if freshrss containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/freshrss/molecule/default/verify_stopped.yml b/roles/freshrss/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f25fad5b
--- /dev/null
+++ b/roles/freshrss/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove freshrss
+ community.docker.docker_container:
+ name: "{{ freshrss_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if freshrss is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/freshrss/tasks/main.yml b/roles/freshrss/tasks/main.yml
index c39bd64d..74494d2c 100644
--- a/roles/freshrss/tasks/main.yml
+++ b/roles/freshrss/tasks/main.yml
@@ -1,32 +1,44 @@
---
-- name: Create FreshRSS Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ freshrss_data_directory }}/data"
- - "{{ freshrss_extensions_directory }}/extensions"
+- name: Start FreshRSS
+ block:
+ - name: Create FreshRSS Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ freshrss_data_directory }}/data"
+ - "{{ freshrss_extensions_directory }}/extensions"
-- name: FreshRSS Docker Container
- docker_container:
- name: freshrss
- image: freshrss/freshrss
- pull: true
- volumes:
- - "{{ freshrss_data_directory }}/data:/var/www/FreshRSS/data:rw"
- - "{{ freshrss_extensions_directory }}/extensions:/var/www/FreshRSS/extensions:rw"
- ports:
- - "{{ freshrss_port }}:80"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- CRON_MIN: "1,31"
- restart_policy: unless-stopped
- memory: "{{ freshrss_memory }}"
- labels:
- traefik.enable: "{{ freshrss_available_externally | string }}"
- traefik.http.routers.freshrss.rule: "Host(`{{ freshrss_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.freshrss.tls.certresolver: "letsencrypt"
- traefik.http.routers.freshrss.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.freshrss.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.freshrss.loadbalancer.server.port: "80"
+ - name: FreshRSS Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ freshrss_container_name }}"
+ image: "{{ freshrss_image_name }}:{{ freshrss_image_version }}"
+ pull: true
+ volumes:
+ - "{{ freshrss_data_directory }}/data:/var/www/FreshRSS/data:rw"
+ - "{{ freshrss_extensions_directory }}/extensions:/var/www/FreshRSS/extensions:rw"
+ ports:
+ - "{{ freshrss_port }}:80"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ CRON_MIN: "1,31"
+ restart_policy: unless-stopped
+ memory: "{{ freshrss_memory }}"
+ labels:
+ traefik.enable: "{{ freshrss_available_externally | string }}"
+ traefik.http.routers.freshrss.rule: "Host(`{{ freshrss_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.freshrss.tls.certresolver: "letsencrypt"
+ traefik.http.routers.freshrss.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.freshrss.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.freshrss.loadbalancer.server.port: "80"
+ when: freshrss_enabled is true
+
+
+- name: Stop FreshRSS
+ block:
+ - name: Stop FreshRSS
+ community.docker.docker_container:
+ name: "{{ freshrss_container_name }}"
+ state: absent
+ when: freshrss_enabled is false
diff --git a/roles/get_iplayer/defaults/main.yml b/roles/get_iplayer/defaults/main.yml
index c45a0124..56aac558 100644
--- a/roles/get_iplayer/defaults/main.yml
+++ b/roles/get_iplayer/defaults/main.yml
@@ -8,5 +8,10 @@ get_iplayer_download_directory: "{{ tv_root }}/iplayer_downloads"
# network
get_iplayer_port: "8182"
+# docker
+get_iplayer_container_name: "get_iplayer"
+get_iplayer_image_name: "kolonuk/get_iplayer"
+get_iplayer_image_version: "latest"
+
# specs
get_iplayer_memory: "1g"
diff --git a/roles/get_iplayer/molecule/default/molecule.yml b/roles/get_iplayer/molecule/default/molecule.yml
new file mode 100644
index 00000000..02aa4913
--- /dev/null
+++ b/roles/get_iplayer/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ get_iplayer_enabled: true
diff --git a/roles/get_iplayer/molecule/default/side_effect.yml b/roles/get_iplayer/molecule/default/side_effect.yml
new file mode 100644
index 00000000..b8671855
--- /dev/null
+++ b/roles/get_iplayer/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ get_iplayer_enabled: false
diff --git a/roles/get_iplayer/molecule/default/verify.yml b/roles/get_iplayer/molecule/default/verify.yml
new file mode 100644
index 00000000..e702ec7b
--- /dev/null
+++ b/roles/get_iplayer/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get get_iplayer container state
+ community.docker.docker_container:
+ name: "{{ get_iplayer_container_name }}"
+ register: result
+
+ - name: Check if get_iplayer containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/get_iplayer/molecule/default/verify_stopped.yml b/roles/get_iplayer/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..dfe21621
--- /dev/null
+++ b/roles/get_iplayer/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove get_iplayer
+ community.docker.docker_container:
+ name: "{{ get_iplayer_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if get_iplayer is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/get_iplayer/tasks/main.yml b/roles/get_iplayer/tasks/main.yml
index 4f05f6e9..4db0cb8f 100644
--- a/roles/get_iplayer/tasks/main.yml
+++ b/roles/get_iplayer/tasks/main.yml
@@ -1,21 +1,33 @@
---
-- name: Create get_iplayer Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ get_iplayer_config_directory }}"
- - "{{ get_iplayer_download_directory }}"
+- name: Start get_iplayer
+ block:
+ - name: Create get_iplayer Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ get_iplayer_config_directory }}"
+ - "{{ get_iplayer_download_directory }}"
-- name: Get_iplayer Docker Container
- docker_container:
- name: get_iplayer
- image: kolonuk/get_iplayer
- pull: true
- volumes:
- - "{{ get_iplayer_config_directory }}:/root/.get_iplayer:rw"
- - "{{ get_iplayer_download_directory }}:/root/output:rw"
- ports:
- - "{{ get_iplayer_port }}:8181"
- restart_policy: unless-stopped
- memory: "{{ get_iplayer_memory }}"
+ - name: Create get_iplayer Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ get_iplayer_container_name }}"
+ image: "{{ get_iplayer_image_name }}:{{ get_iplayer_image_version }}"
+ pull: true
+ volumes:
+ - "{{ get_iplayer_config_directory }}:/root/.get_iplayer:rw"
+ - "{{ get_iplayer_download_directory }}:/root/output:rw"
+ ports:
+ - "{{ get_iplayer_port }}:8181"
+ restart_policy: unless-stopped
+ memory: "{{ get_iplayer_memory }}"
+ when: get_iplayer_enabled is true
+
+- name: Stop get_iplayer
+ block:
+ - name: Stop get_iplayer
+ community.docker.docker_container:
+ name: "{{ get_iplayer_container_name }}"
+ state: absent
+ when: get_iplayer_enabled is false
diff --git a/roles/gitea/defaults/main.yml b/roles/gitea/defaults/main.yml
index a83fbe95..7bb7b97b 100644
--- a/roles/gitea/defaults/main.yml
+++ b/roles/gitea/defaults/main.yml
@@ -7,6 +7,7 @@ gitea_data_directory: "{{ docker_home }}/gitea"
# network
gitea_hostname: "gitea"
+gitea_network_name: "gitea"
gitea_port_http: "3001"
gitea_port_ssh: "222"
@@ -16,4 +17,8 @@ gitea_mysql_memory: 1g
# docker
gitea_container_name: gitea
+gitea_image_name: gitea/gitea
+gitea_image_version: latest
gitea_mysql_container_name: gitea-mysql
+gitea_mysql_image_name: mysql
+gitea_mysql_image_version: "5.7"
diff --git a/roles/gitea/molecule/default/molecule.yml b/roles/gitea/molecule/default/molecule.yml
new file mode 100644
index 00000000..934916d3
--- /dev/null
+++ b/roles/gitea/molecule/default/molecule.yml
@@ -0,0 +1,7 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ gitea_enabled: true
+ ansible_nas_hostname: ansible-nas
diff --git a/roles/gitea/molecule/default/side_effect.yml b/roles/gitea/molecule/default/side_effect.yml
new file mode 100644
index 00000000..7b75a3f9
--- /dev/null
+++ b/roles/gitea/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ gitea_enabled: false
diff --git a/roles/gitea/molecule/default/verify.yml b/roles/gitea/molecule/default/verify.yml
new file mode 100644
index 00000000..d8924eb2
--- /dev/null
+++ b/roles/gitea/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get gitea container state
+ community.docker.docker_container:
+ name: "{{ gitea_container_name }}"
+ register: result
+
+ - name: Check if gitea containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/gitea/molecule/default/verify_stopped.yml b/roles/gitea/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..0c3182e8
--- /dev/null
+++ b/roles/gitea/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove gitea
+ community.docker.docker_container:
+ name: "{{ gitea_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if gitea is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml
index 0da9f232..b7b554bd 100644
--- a/roles/gitea/tasks/main.yml
+++ b/roles/gitea/tasks/main.yml
@@ -10,11 +10,19 @@
- "{{ gitea_data_directory }}/gitea"
- "{{ gitea_data_directory }}/mysql"
+ - name: Create gitea network
+ community.docker.docker_network:
+ name: "{{ gitea_network_name }}"
+
- name: Create MySQL container for Gitea
- docker_container:
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
name: "{{ gitea_mysql_container_name }}"
- image: mysql:5.7
+ image: "{{ gitea_mysql_image_name }}:{{ gitea_mysql_image_version }}"
pull: true
+ networks:
+ - name: "{{ gitea_network_name }}"
+ network_mode: "{{ gitea_network_name }}"
volumes:
- "{{ gitea_data_directory }}/mysql:/var/lib/mysql:rw"
env:
@@ -26,12 +34,14 @@
memory: "{{ gitea_mysql_memory }}"
- name: Create Gitea container
- docker_container:
- name: gitea
- image: gitea/gitea:latest
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ gitea_container_name }}"
+ image: "{{ gitea_image_name }}:{{ gitea_image_version }}"
pull: true
- links:
- - gitea-mysql:db
+ networks:
+ - name: "{{ gitea_network_name }}"
+ network_mode: "{{ gitea_network_name }}"
volumes:
- "{{ gitea_data_directory }}/gitea:/data:rw"
ports:
@@ -39,7 +49,7 @@
- "{{ gitea_port_ssh }}:22"
env:
DB_TYPE: "mysql"
- DB_HOST: "db:3306"
+ DB_HOST: "{{ gitea_mysql_container_name }}:3306"
DB_NAME: "gitea"
DB_USER: "gitea"
DB_PASSWD: "gitea"
diff --git a/roles/gitlab/defaults/main.yml b/roles/gitlab/defaults/main.yml
index d663eb2f..db33f9d7 100644
--- a/roles/gitlab/defaults/main.yml
+++ b/roles/gitlab/defaults/main.yml
@@ -12,5 +12,12 @@ gitlab_port_http: "4080"
gitlab_port_https: "4443"
gitlab_port_ssh: "422"
+# docker
+gitlab_container_name: "gitlab"
+gitlab_image_name: "gitlab/gitlab-ce"
+gitlab_image_version: "latest"
+gitlab_user_id: "1000"
+gitlab_group_id: "1000"
+
# specs
gitlab_memory: "4g"
diff --git a/roles/gitlab/molecule/default/molecule.yml b/roles/gitlab/molecule/default/molecule.yml
new file mode 100644
index 00000000..177a9b8c
--- /dev/null
+++ b/roles/gitlab/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ gitlab_enabled: true
diff --git a/roles/gitlab/molecule/default/side_effect.yml b/roles/gitlab/molecule/default/side_effect.yml
new file mode 100644
index 00000000..1c319b01
--- /dev/null
+++ b/roles/gitlab/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ gitlab_enabled: false
diff --git a/roles/gitlab/molecule/default/verify.yml b/roles/gitlab/molecule/default/verify.yml
new file mode 100644
index 00000000..318e6b65
--- /dev/null
+++ b/roles/gitlab/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get gitlab container state
+ community.docker.docker_container:
+ name: "{{ gitlab_container_name }}"
+ register: result
+
+ - name: Check if gitlab containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/gitlab/molecule/default/verify_stopped.yml b/roles/gitlab/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..46bcc078
--- /dev/null
+++ b/roles/gitlab/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove gitlab
+ community.docker.docker_container:
+ name: "{{ gitlab_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if gitlab is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/gitlab/tasks/main.yml b/roles/gitlab/tasks/main.yml
index 31f2d4c9..549da0b2 100644
--- a/roles/gitlab/tasks/main.yml
+++ b/roles/gitlab/tasks/main.yml
@@ -1,57 +1,69 @@
---
-# The gitlab uid/gid matches 'git:git' in the Gitlab Docker image.
-- name: Create Gitlab group account
- group:
- name: gitlab
- gid: 998
- state: present
+- name: Start Gitlab
+ block:
+ # The gitlab uid/gid matches 'git:git' in the Gitlab Docker image.
+ - name: Create Gitlab group account
+ group:
+ name: gitlab
+ gid: 998
+ state: present
-- name: Create Gitlab user account
- user:
- name: gitlab
- uid: 998
- state: present
- system: yes
- update_password: on_create
- create_home: no
- group: gitlab
+ - name: Create Gitlab user account
+ user:
+ name: gitlab
+ uid: 998
+ state: present
+ system: yes
+ update_password: on_create
+ create_home: no
+ group: gitlab
-- name: Create Gitlab Directories
- file:
- path: "{{ item }}"
- state: directory
- owner: gitlab
- group: gitlab
- with_items:
- - "{{ gitlab_data_directory }}/config"
- - "{{ gitlab_data_directory }}/log"
- - "{{ gitlab_data_directory }}/data"
+ - name: Create Gitlab Directories
+ file:
+ path: "{{ item }}"
+ state: directory
+ owner: gitlab
+ group: gitlab
+ with_items:
+ - "{{ gitlab_data_directory }}/config"
+ - "{{ gitlab_data_directory }}/log"
+ - "{{ gitlab_data_directory }}/data"
-- name: Create Gitlab Docker Container
- docker_container:
- name: gitlab
- image: gitlab/gitlab-ce:latest
- pull: true
- volumes:
- - "{{ gitlab_data_directory }}/config:/etc/gitlab:rw"
- - "{{ gitlab_data_directory }}/log:/var/log/gitlab:rw"
- - "{{ gitlab_data_directory }}/data:/var/opt/gitlab:rw"
- network_mode: "bridge"
- ports:
- - "{{ gitlab_port_http }}:80"
- - "{{ gitlab_port_https }}:443"
- - "{{ gitlab_port_ssh }}:22"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ gitlab_user_id }}"
- PGID: "{{ gitlab_group_id }}"
- restart_policy: unless-stopped
- hostname: "{{ gitlab_hostname }}.{{ ansible_nas_domain }}"
- memory: "{{ gitlab_memory }}"
- labels:
- traefik.enable: "{{ gitlab_available_externally | string }}"
- traefik.http.routers.gitlab.rule: "Host(`{{ gitlab_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.gitlab.tls.certresolver: "letsencrypt"
- traefik.http.routers.gitlab.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.gitlab.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.gitlab.loadbalancer.server.port: "80"
+ - name: Create Gitlab Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ gitlab_container_name }}"
+ image: "{{ gitlab_image_name }}:{{ gitlab_image_version }}"
+ pull: true
+ volumes:
+ - "{{ gitlab_data_directory }}/config:/etc/gitlab:rw"
+ - "{{ gitlab_data_directory }}/log:/var/log/gitlab:rw"
+ - "{{ gitlab_data_directory }}/data:/var/opt/gitlab:rw"
+ network_mode: "bridge"
+ ports:
+ - "{{ gitlab_port_http }}:80"
+ - "{{ gitlab_port_https }}:443"
+ - "{{ gitlab_port_ssh }}:22"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ gitlab_user_id }}"
+ PGID: "{{ gitlab_group_id }}"
+ restart_policy: unless-stopped
+ hostname: "{{ gitlab_hostname }}.{{ ansible_nas_domain }}"
+ memory: "{{ gitlab_memory }}"
+ labels:
+ traefik.enable: "{{ gitlab_available_externally | string }}"
+ traefik.http.routers.gitlab.rule: "Host(`{{ gitlab_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.gitlab.tls.certresolver: "letsencrypt"
+ traefik.http.routers.gitlab.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.gitlab.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.gitlab.loadbalancer.server.port: "80"
+ when: gitlab_enabled is true
+
+- name: Stop Gitlab
+ block:
+ - name: Stop Gitlab
+ community.docker.docker_container:
+ name: "{{ gitlab_container_name }}"
+ state: absent
+ when: gitlab_enabled is false
diff --git a/roles/glances/defaults/main.yml b/roles/glances/defaults/main.yml
index d5fbc587..f54f5bea 100644
--- a/roles/glances/defaults/main.yml
+++ b/roles/glances/defaults/main.yml
@@ -12,5 +12,10 @@ glances_port_two: "61209"
glances_security_options:
- "apparmor=unconfined"
+# docker
+glances_container_name: "glances"
+glances_image_name: "nicolargo/glances"
+glances_image_version: "latest"
+
# specs
glances_memory: 1g
diff --git a/roles/glances/molecule/default/molecule.yml b/roles/glances/molecule/default/molecule.yml
new file mode 100644
index 00000000..425b90c9
--- /dev/null
+++ b/roles/glances/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ glances_enabled: true
diff --git a/roles/glances/molecule/default/side_effect.yml b/roles/glances/molecule/default/side_effect.yml
new file mode 100644
index 00000000..b1924b70
--- /dev/null
+++ b/roles/glances/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ glances_enabled: false
diff --git a/roles/glances/molecule/default/verify.yml b/roles/glances/molecule/default/verify.yml
new file mode 100644
index 00000000..2a9e2cc2
--- /dev/null
+++ b/roles/glances/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get glances container state
+ community.docker.docker_container:
+ name: "{{ glances_container_name }}"
+ register: result
+
+ - name: Check if glances containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/glances/molecule/default/verify_stopped.yml b/roles/glances/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..5fcee409
--- /dev/null
+++ b/roles/glances/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove glances
+ community.docker.docker_container:
+ name: "{{ glances_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if glances is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/glances/tasks/main.yml b/roles/glances/tasks/main.yml
index f732f268..a89a7f24 100644
--- a/roles/glances/tasks/main.yml
+++ b/roles/glances/tasks/main.yml
@@ -1,25 +1,37 @@
---
-- name: Create Glances Docker Container
- docker_container:
- name: glances
- image: nicolargo/glances
- pull: true
- volumes:
- - "/var/run/docker.sock:/var/run/docker.sock:ro"
- - "/etc/timezone:/etc/timezone:ro"
- pid_mode: host
- ports:
- - "{{ glances_port_one }}:61208"
- - "{{ glances_port_two }}:61209"
- env:
- GLANCES_OPT: "-w"
- restart_policy: unless-stopped
- security_opts: "{{ glances_security_options }}"
- memory: "{{ glances_memory }}"
- labels:
- traefik.enable: "{{ glances_available_externally | string }}"
- traefik.http.routers.glances.rule: "Host(`{{ glances_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.glances.tls.certresolver: "letsencrypt"
- traefik.http.routers.glances.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.glances.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.glances.loadbalancer.server.port: "61208"
+- name: Start Glances
+ block:
+ - name: Create Glances Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ glances_container_name }}"
+ image: "{{ glances_image_name }}:{{ glances_image_version }}"
+ pull: true
+ volumes:
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
+ - "/etc/timezone:/etc/timezone:ro"
+ pid_mode: host
+ ports:
+ - "{{ glances_port_one }}:61208"
+ - "{{ glances_port_two }}:61209"
+ env:
+ GLANCES_OPT: "-w"
+ restart_policy: unless-stopped
+ security_opts: "{{ glances_security_options }}"
+ memory: "{{ glances_memory }}"
+ labels:
+ traefik.enable: "{{ glances_available_externally | string }}"
+ traefik.http.routers.glances.rule: "Host(`{{ glances_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.glances.tls.certresolver: "letsencrypt"
+ traefik.http.routers.glances.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.glances.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.glances.loadbalancer.server.port: "61208"
+ when: glances_enabled is true
+
+- name: Stop Glances
+ block:
+ - name: Stop Glances
+ community.docker.docker_container:
+ name: "{{ glances_container_name }}"
+ state: absent
+ when: glances_enabled is false
diff --git a/roles/gotify/defaults/main.yml b/roles/gotify/defaults/main.yml
index 1ae240af..6bd37c22 100644
--- a/roles/gotify/defaults/main.yml
+++ b/roles/gotify/defaults/main.yml
@@ -5,14 +5,14 @@ gotify_available_externally: false
# data directory
gotify_data_directory: "{{ docker_home }}/gotify"
-# docker image to use
-gotify_docker_image: gotify/server:latest
-
# network
gotify_port: "2346"
gotify_hostname: "gotify"
-# user to run container with
+# docker
+gotify_container_name: "gotify"
+gotify_image_name: "gotify/server"
+gotify_image_version: "latest"
gotify_user_id: "0"
gotify_group_id: "0"
diff --git a/roles/gotify/molecule/default/molecule.yml b/roles/gotify/molecule/default/molecule.yml
new file mode 100644
index 00000000..bcda5085
--- /dev/null
+++ b/roles/gotify/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ gotify_enabled: true
diff --git a/roles/gotify/molecule/default/side_effect.yml b/roles/gotify/molecule/default/side_effect.yml
new file mode 100644
index 00000000..36038c8e
--- /dev/null
+++ b/roles/gotify/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ gotify_enabled: false
diff --git a/roles/gotify/molecule/default/verify.yml b/roles/gotify/molecule/default/verify.yml
new file mode 100644
index 00000000..62059cb7
--- /dev/null
+++ b/roles/gotify/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get gotify container state
+ community.docker.docker_container:
+ name: "{{ gotify_container_name }}"
+ register: result
+
+ - name: Check if gotify containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/gotify/molecule/default/verify_stopped.yml b/roles/gotify/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..541bbe3d
--- /dev/null
+++ b/roles/gotify/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove gotify
+ community.docker.docker_container:
+ name: "{{ gotify_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if gotify is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/gotify/tasks/main.yml b/roles/gotify/tasks/main.yml
index 7560d692..ef6f33f8 100644
--- a/roles/gotify/tasks/main.yml
+++ b/roles/gotify/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create Gotify Data Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ gotify_data_directory }}"
+- name: Start Gotify
+ block:
+ - name: Create Gotify Data Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ gotify_data_directory }}"
-- name: Gotify Docker Container
- docker_container:
- name: gotify
- image: "{{ gotify_docker_image }}"
- pull: true
- ports:
- - "{{ gotify_port }}:80"
- volumes:
- - "/var/run/docker.sock:/var/run/docker.sock"
- - "{{ gotify_data_directory }}:/app/data:rw"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ gotify_user_id }}"
- PGID: "{{ gotify_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ gotify_memory }}"
- labels:
- traefik.enable: "{{ gotify_available_externally | string }}"
- traefik.http.routers.gotify.rule: "Host(`{{ gotify_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.gotify.tls.certresolver: "letsencrypt"
- traefik.http.routers.gotify.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.gotify.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.gotify.loadbalancer.server.port: "80"
+ - name: Gotify Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ gotify_container_name }}"
+ image: "{{ gotify_image_name }}:{{ gotify_image_version }}"
+ pull: true
+ ports:
+ - "{{ gotify_port }}:80"
+ volumes:
+ - "/var/run/docker.sock:/var/run/docker.sock"
+ - "{{ gotify_data_directory }}:/app/data:rw"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ gotify_user_id }}"
+ PGID: "{{ gotify_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ gotify_memory }}"
+ labels:
+ traefik.enable: "{{ gotify_available_externally | string }}"
+ traefik.http.routers.gotify.rule: "Host(`{{ gotify_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.gotify.tls.certresolver: "letsencrypt"
+ traefik.http.routers.gotify.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.gotify.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.gotify.loadbalancer.server.port: "80"
+ when: gotify_enabled is true
+
+- name: Stop Gotify
+ block:
+ - name: Stop Gotify
+ community.docker.docker_container:
+ name: "{{ gotify_container_name }}"
+ state: absent
+ when: gotify_enabled is false
diff --git a/roles/guacamole/defaults/main.yml b/roles/guacamole/defaults/main.yml
index 04147f56..ce2f2af3 100644
--- a/roles/guacamole/defaults/main.yml
+++ b/roles/guacamole/defaults/main.yml
@@ -9,5 +9,10 @@ guacamole_data_directory: "{{ docker_home }}/guacamole"
guacamole_port: "8090"
guacamole_hostname: "guacamole"
+# docker
+guacamole_container_name: "guacamole"
+guacamole_image_name: "oznu/guacamole"
+guacamole_image_version: "latest"
+
# specs
guacamole_memory: 1g
diff --git a/roles/guacamole/molecule/default/molecule.yml b/roles/guacamole/molecule/default/molecule.yml
new file mode 100644
index 00000000..6522e319
--- /dev/null
+++ b/roles/guacamole/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ guacamole_enabled: true
diff --git a/roles/guacamole/molecule/default/side_effect.yml b/roles/guacamole/molecule/default/side_effect.yml
new file mode 100644
index 00000000..ca633833
--- /dev/null
+++ b/roles/guacamole/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ guacamole_enabled: false
diff --git a/roles/guacamole/molecule/default/verify.yml b/roles/guacamole/molecule/default/verify.yml
new file mode 100644
index 00000000..dc90031f
--- /dev/null
+++ b/roles/guacamole/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get guacamole container state
+ community.docker.docker_container:
+ name: "{{ guacamole_container_name }}"
+ register: result
+
+ - name: Check if guacamole containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/guacamole/molecule/default/verify_stopped.yml b/roles/guacamole/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f3b6955b
--- /dev/null
+++ b/roles/guacamole/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove guacamole
+ community.docker.docker_container:
+ name: "{{ guacamole_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if guacamole is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/guacamole/tasks/main.yml b/roles/guacamole/tasks/main.yml
index 913067c1..5a3be004 100644
--- a/roles/guacamole/tasks/main.yml
+++ b/roles/guacamole/tasks/main.yml
@@ -1,51 +1,64 @@
---
-- name: Create Guacamole directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ guacamole_data_directory }}/config"
+- name: Start Guacamole
+ block:
+ - name: Create Guacamole directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ guacamole_data_directory }}/config"
-- name: Remove Old Guacamole Mysql Docker Container
- docker_container:
- name: guacamole-mysql
- state: absent
- keep_volumes: true
+ - name: Remove Old Guacamole Mysql Docker Container
+ docker_container:
+ name: guacamole-mysql
+ state: absent
+ keep_volumes: true
-- name: Remove Old Guacamole guacd Docker Container
- docker_container:
- name: guacamole-guacd
- state: absent
- keep_volumes: true
+ - name: Remove Old Guacamole guacd Docker Container
+ docker_container:
+ name: guacamole-guacd
+ state: absent
+ keep_volumes: true
-- name: Remove old Guacamole directories
- file:
- path: "{{ item }}"
- state: absent
- with_items:
- - "{{ guacamole_data_directory }}/mysql"
+ - name: Remove old Guacamole directories
+ file:
+ path: "{{ item }}"
+ state: absent
+ with_items:
+ - "{{ guacamole_data_directory }}/mysql"
-- name: Guacamole Container
- docker_container:
- name: guacamole
- image: "oznu/guacamole"
- pull: true
- volumes:
- - "{{ guacamole_data_directory }}/config:/config:rw"
- ports:
- - "{{ guacamole_port }}:8080"
- restart_policy: unless-stopped
- memory: "{{ guacamole_memory }}"
- labels:
- traefik.enable: "{{ guacamole_available_externally | string }}"
- traefik.http.routers.guacamole.rule: "Host(`{{ guacamole_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.guacamole.tls.certresolver: "letsencrypt"
- traefik.http.routers.guacamole.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.guacamole.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.guacamole.loadbalancer.server.port: "8080"
+ - name: Guacamole Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ guacamole_container_name }}"
+ image: "{{ guacamole_image_name }}:{{ guacamole_image_version }}"
+ pull: true
+ volumes:
+ - "{{ guacamole_data_directory }}/config:/config:rw"
+ ports:
+ - "{{ guacamole_port }}:8080"
+ restart_policy: unless-stopped
+ memory: "{{ guacamole_memory }}"
+ labels:
+ traefik.enable: "{{ guacamole_available_externally | string }}"
+ traefik.http.routers.guacamole.rule: "Host(`{{ guacamole_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.guacamole.tls.certresolver: "letsencrypt"
+ traefik.http.routers.guacamole.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.guacamole.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.guacamole.loadbalancer.server.port: "8080"
-- name: Restart Guacamole Container
- docker_container:
- name: guacamole
- image: "oznu/guacamole"
- restart: true
+ - name: Restart Guacamole Container
+ community.docker.docker_container:
+ name: "{{ guacamole_container_name }}"
+ image: "{{ guacamole_image_name }}:{{ guacamole_image_version }}"
+ restart: true
+ tags: molecule-idempotence-notest
+ when: guacamole_enabled is true
+
+- name: Stop Guacamole
+ block:
+ - name: Stop Guacamole
+ community.docker.docker_container:
+ name: "{{ guacamole_container_name }}"
+ state: absent
+ when: guacamole_enabled is false
diff --git a/roles/healthchecks.io/molecule/default/molecule.yml b/roles/healthchecks.io/molecule/default/molecule.yml
new file mode 100644
index 00000000..5343b31e
--- /dev/null
+++ b/roles/healthchecks.io/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ healthchecks_enabled: true
diff --git a/roles/healthchecks.io/molecule/default/side_effect.yml b/roles/healthchecks.io/molecule/default/side_effect.yml
new file mode 100644
index 00000000..2b445448
--- /dev/null
+++ b/roles/healthchecks.io/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ healthchecks_enabled: false
diff --git a/roles/healthchecks.io/molecule/default/verify.yml b/roles/healthchecks.io/molecule/default/verify.yml
new file mode 100644
index 00000000..69fff456
--- /dev/null
+++ b/roles/healthchecks.io/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Check cron job file
+ ansible.builtin.fetch:
+ src: /var/spool/cron/crontabs/root
+ dest: /tmp/fetched
+
+ - name: Check if cron job does exist
+ ansible.builtin.assert:
+ that: "lookup('file', '/tmp/fetched/instance/var/spool/cron/crontabs/root') is search('healthchecks.io')"
+ fail_msg: "Cron job 'healthchecks.io' does not exist!"
+ success_msg: "Cron job 'healthchecks.io' does exist!"
diff --git a/roles/healthchecks.io/molecule/default/verify_stopped.yml b/roles/healthchecks.io/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..b0fa2024
--- /dev/null
+++ b/roles/healthchecks.io/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Check cron job file
+ ansible.builtin.fetch:
+ src: /var/spool/cron/crontabs/root
+ dest: /tmp/fetched
+
+ - name: Check if cron job does not exist
+ ansible.builtin.assert:
+ that: "not lookup('file', '/tmp/fetched/instance/var/spool/cron/crontabs/root') is search('healthchecks.io')"
+ fail_msg: "Cron job 'healthchecks.io' still exists!"
+ success_msg: "Cron job 'healthchecks.io' does not exist!"
diff --git a/roles/healthchecks.io/tasks/main.yml b/roles/healthchecks.io/tasks/main.yml
index e9a7e145..0e79f7cf 100644
--- a/roles/healthchecks.io/tasks/main.yml
+++ b/roles/healthchecks.io/tasks/main.yml
@@ -1,7 +1,19 @@
---
-- name: Add healthchecks.io cronjob
- cron:
- name: healthchecks.io
- minute: "*/{{ healthchecks_ping_minutes }}"
- user: root
- job: "curl -m 10 --retry 5 {{ healthchecks_url }}"
+- name: Start Healthchecks
+ block:
+ - name: Add healthchecks.io cronjob
+ ansible.builtin.cron:
+ name: healthchecks.io
+ minute: "*/{{ healthchecks_ping_minutes }}"
+ user: root
+ job: "curl -m 10 --retry 5 {{ healthchecks_url }}"
+ when: healthchecks_enabled is true
+
+- name: Stop Healthchecks
+ block:
+ - name: Remove healthchecks.io cronjob
+ ansible.builtin.cron:
+ name: healthchecks.io
+ user: root
+ state: absent
+ when: healthchecks_enabled is false
diff --git a/roles/heimdall/molecule/default/verify.yml b/roles/heimdall/molecule/default/verify.yml
index fbeb6021..e812328e 100644
--- a/roles/heimdall/molecule/default/verify.yml
+++ b/roles/heimdall/molecule/default/verify.yml
@@ -5,7 +5,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/heimdall/molecule/default/verify_stopped.yml b/roles/heimdall/molecule/default/verify_stopped.yml
index 2be7a52d..1181dd36 100644
--- a/roles/heimdall/molecule/default/verify_stopped.yml
+++ b/roles/heimdall/molecule/default/verify_stopped.yml
@@ -5,7 +5,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Heimdall
diff --git a/roles/hello_world/molecule/default/verify.yml b/roles/hello_world/molecule/default/verify.yml
index 1cf221a3..d0345f30 100644
--- a/roles/hello_world/molecule/default/verify.yml
+++ b/roles/hello_world/molecule/default/verify.yml
@@ -5,7 +5,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Get container state
diff --git a/roles/hello_world/molecule/default/verify_stopped.yml b/roles/hello_world/molecule/default/verify_stopped.yml
index 4f4cc4dd..1360f1a4 100644
--- a/roles/hello_world/molecule/default/verify_stopped.yml
+++ b/roles/hello_world/molecule/default/verify_stopped.yml
@@ -5,7 +5,8 @@
hosts: all
gather_facts: false
tasks:
- - include_vars:
+ - name: Include vars
+ include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Hello World
diff --git a/roles/homeassistant/defaults/main.yml b/roles/homeassistant/defaults/main.yml
index 7490d2e1..dd6d857f 100644
--- a/roles/homeassistant/defaults/main.yml
+++ b/roles/homeassistant/defaults/main.yml
@@ -9,5 +9,10 @@ homeassistant_data_directory: "{{ docker_home }}/homeassistant"
homeassistant_port: "8123"
homeassistant_hostname: "homeassistant"
+# docker
+homeassistant_container_name: "homeassistant"
+homeassistant_image_name: "homeassistant/home-assistant"
+homeassistant_image_version: latest
+
# specs
homeassistant_memory: 1g
diff --git a/roles/homeassistant/molecule/default/molecule.yml b/roles/homeassistant/molecule/default/molecule.yml
new file mode 100644
index 00000000..8d74fd32
--- /dev/null
+++ b/roles/homeassistant/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ homeassistant_enabled: true
diff --git a/roles/homeassistant/molecule/default/side_effect.yml b/roles/homeassistant/molecule/default/side_effect.yml
new file mode 100644
index 00000000..7fd43749
--- /dev/null
+++ b/roles/homeassistant/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ homeassistant_enabled: false
diff --git a/roles/homeassistant/molecule/default/verify.yml b/roles/homeassistant/molecule/default/verify.yml
new file mode 100644
index 00000000..e2165892
--- /dev/null
+++ b/roles/homeassistant/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get homeassistant container state
+ community.docker.docker_container:
+ name: "{{ homeassistant_container_name }}"
+ register: result
+
+ - name: Check if homeassistant containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/homeassistant/molecule/default/verify_stopped.yml b/roles/homeassistant/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..e4d2ab86
--- /dev/null
+++ b/roles/homeassistant/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove homeassistant
+ community.docker.docker_container:
+ name: "{{ homeassistant_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if homeassistant is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/homeassistant/tasks/main.yml b/roles/homeassistant/tasks/main.yml
index 1f211cd1..0c1ee603 100644
--- a/roles/homeassistant/tasks/main.yml
+++ b/roles/homeassistant/tasks/main.yml
@@ -1,27 +1,39 @@
---
-- name: Create Home Assistant Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ homeassistant_data_directory }}/config"
+- name: Start Homeassistant
+ block:
+ - name: Create Home Assistant Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ homeassistant_data_directory }}/config"
-- name: Home Assistant Docker Container
- docker_container:
- name: homeassistant
- image: homeassistant/home-assistant
- pull: true
- volumes:
- - "{{ homeassistant_data_directory }}/config:/config:rw"
- network_mode: host
- restart_policy: unless-stopped
- env:
- TZ: "{{ ansible_nas_timezone }}"
- labels:
- traefik.enable: "{{ homeassistant_available_externally | string }}"
- traefik.http.routers.homeassistant.rule: "Host(`{{ homeassistant_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.homeassistant.tls.certresolver: "letsencrypt"
- traefik.http.routers.homeassistant.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.homeassistant.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.homeassistant.loadbalancer.server.port: "8123"
- memory: "{{ homeassistant_memory }}"
+ - name: Home Assistant Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ homeassistant_container_name }}"
+ image: "{{ homeassistant_image_name }}:{{ homeassistant_image_version }}"
+ pull: true
+ volumes:
+ - "{{ homeassistant_data_directory }}/config:/config:rw"
+ network_mode: host
+ restart_policy: unless-stopped
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ labels:
+ traefik.enable: "{{ homeassistant_available_externally | string }}"
+ traefik.http.routers.homeassistant.rule: "Host(`{{ homeassistant_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.homeassistant.tls.certresolver: "letsencrypt"
+ traefik.http.routers.homeassistant.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.homeassistant.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.homeassistant.loadbalancer.server.port: "8123"
+ memory: "{{ homeassistant_memory }}"
+ when: homeassistant_enabled is true
+
+- name: Stop homeassistant
+ block:
+ - name: Stop homeassistant
+ community.docker.docker_container:
+ name: "{{ homeassistant_container_name }}"
+ state: absent
+ when: homeassistant_enabled is false
diff --git a/roles/homebridge/defaults/main.yml b/roles/homebridge/defaults/main.yml
index 03ef2181..286e8990 100644
--- a/roles/homebridge/defaults/main.yml
+++ b/roles/homebridge/defaults/main.yml
@@ -14,5 +14,10 @@ homebridge_group_id: "0"
homebridge_hostname: "homebridge"
homebridge_port: "8087"
+# docker
+homebridge_container_name: "homebridge"
+homebridge_image_name: "oznu/homebridge"
+homebridge_image_version: "latest"
+
# specs
homebridge_memory: "1g"
diff --git a/roles/homebridge/molecule/default/molecule.yml b/roles/homebridge/molecule/default/molecule.yml
new file mode 100644
index 00000000..57e51aec
--- /dev/null
+++ b/roles/homebridge/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ homebridge_enabled: true
diff --git a/roles/homebridge/molecule/default/side_effect.yml b/roles/homebridge/molecule/default/side_effect.yml
new file mode 100644
index 00000000..c8cf2044
--- /dev/null
+++ b/roles/homebridge/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ homebridge_enabled: false
diff --git a/roles/homebridge/molecule/default/verify.yml b/roles/homebridge/molecule/default/verify.yml
new file mode 100644
index 00000000..0fa3521c
--- /dev/null
+++ b/roles/homebridge/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get homebridge container state
+ community.docker.docker_container:
+ name: "{{ homebridge_container_name }}"
+ register: result
+
+ - name: Check if homebridge containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/homebridge/molecule/default/verify_stopped.yml b/roles/homebridge/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f5539057
--- /dev/null
+++ b/roles/homebridge/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove homebridge
+ community.docker.docker_container:
+ name: "{{ homebridge_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if homebridge is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/homebridge/tasks/main.yml b/roles/homebridge/tasks/main.yml
index 55f50fd6..2ac79111 100644
--- a/roles/homebridge/tasks/main.yml
+++ b/roles/homebridge/tasks/main.yml
@@ -1,32 +1,44 @@
---
-- name: Create Homebridge Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ homebridge_config_directory }}"
+- name: Start Homebridge
+ block:
+ - name: Create Homebridge Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ homebridge_config_directory }}"
-- name: Create Homebridge Docker Container
- docker_container:
- name: homebridge
- image: oznu/homebridge
- pull: true
- volumes:
- - "{{ homebridge_config_directory }}:/homebridge"
- network_mode: "host"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PGID: "{{ homebridge_group_id }}"
- PUID: "{{ homebridge_user_id }}"
- HOMEBRIDGE_CONFIG_UI: "1"
- HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_port }}"
- restart_policy: unless-stopped
- memory: "{{ homebridge_memory }}"
- labels:
- traefik.enable: "{{ homebridge_available_externally | string }}"
- traefik.http.routers.homebridge.rule: "Host(`{{ homebridge_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.homebridge.tls.certresolver: "letsencrypt"
- traefik.http.routers.homebridge.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.homebridge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.homebridge.loadbalancer.server.port: "8087"
+ - name: Create Homebridge Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ homebridge_container_name }}"
+ image: "{{ homebridge_image_name }}:{{ homebridge_image_version }}"
+ pull: true
+ volumes:
+ - "{{ homebridge_config_directory }}:/homebridge"
+ network_mode: "host"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PGID: "{{ homebridge_group_id }}"
+ PUID: "{{ homebridge_user_id }}"
+ HOMEBRIDGE_CONFIG_UI: "1"
+ HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_port }}"
+ restart_policy: unless-stopped
+ memory: "{{ homebridge_memory }}"
+ labels:
+ traefik.enable: "{{ homebridge_available_externally | string }}"
+ traefik.http.routers.homebridge.rule: "Host(`{{ homebridge_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.homebridge.tls.certresolver: "letsencrypt"
+ traefik.http.routers.homebridge.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.homebridge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.homebridge.loadbalancer.server.port: "8087"
+ when: homebridge_enabled is true
+
+- name: Stop Homebridge
+ block:
+ - name: Stop Homebridge
+ community.docker.docker_container:
+ name: "{{ homebridge_container_name }}"
+ state: absent
+ when: homebridge_enabled is false
diff --git a/roles/jackett/defaults/main.yml b/roles/jackett/defaults/main.yml
index 5d87e721..a1cd3793 100644
--- a/roles/jackett/defaults/main.yml
+++ b/roles/jackett/defaults/main.yml
@@ -11,5 +11,10 @@ jackett_torrents_root: "{{ torrents_root }}"
jackett_hostname: "jackett"
jackett_port: "9117"
+# docker
+jackett_container_name: "jackett"
+jackett_image_name: "linuxserver/jackett"
+jackett_image_version: "latest"
+
# specs
jackett_memory: "1g"
diff --git a/roles/jackett/molecule/default/molecule.yml b/roles/jackett/molecule/default/molecule.yml
new file mode 100644
index 00000000..44642cb1
--- /dev/null
+++ b/roles/jackett/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ jackett_enabled: true
diff --git a/roles/jackett/molecule/default/side_effect.yml b/roles/jackett/molecule/default/side_effect.yml
new file mode 100644
index 00000000..a83651bf
--- /dev/null
+++ b/roles/jackett/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ jackett_enabled: false
diff --git a/roles/jackett/molecule/default/verify.yml b/roles/jackett/molecule/default/verify.yml
new file mode 100644
index 00000000..387a850e
--- /dev/null
+++ b/roles/jackett/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get jackett container state
+ community.docker.docker_container:
+ name: "{{ jackett_container_name }}"
+ register: result
+
+ - name: Check if jackett containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/jackett/molecule/default/verify_stopped.yml b/roles/jackett/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f5726052
--- /dev/null
+++ b/roles/jackett/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove jackett
+ community.docker.docker_container:
+ name: "{{ jackett_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if jackett is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/jackett/tasks/main.yml b/roles/jackett/tasks/main.yml
index ed903613..bffc6121 100644
--- a/roles/jackett/tasks/main.yml
+++ b/roles/jackett/tasks/main.yml
@@ -1,29 +1,41 @@
---
-- name: Create jackett Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ jackett_data_directory }}"
+- name: Start Jackett
+ block:
+ - name: Create Jackett Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ jackett_data_directory }}"
-- name: Jackett Docker Container
- docker_container:
- name: jackett
- image: linuxserver/jackett
- volumes:
- - "{{ jackett_data_directory }}:/config:rw"
- - "/etc/localtime:/etc/localtime:ro"
- - "{{ jackett_torrents_root }}:/downloads"
- ports:
- - "{{ jackett_port }}:9117"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- restart_policy: unless-stopped
- memory: "{{ jackett_memory }}"
- labels:
- traefik.enable: "{{ jackett_available_externally | string }}"
- traefik.http.routers.jackett.rule: "Host(`{{ jackett_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.jackett.tls.certresolver: "letsencrypt"
- traefik.http.routers.jackett.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.jackett.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.jackett.loadbalancer.server.port: "9117"
+ - name: Jackett Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ jackett_container_name }}"
+ image: "{{ jackett_image_name }}:{{ jackett_image_version }}"
+ volumes:
+ - "{{ jackett_data_directory }}:/config:rw"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "{{ jackett_torrents_root }}:/downloads"
+ ports:
+ - "{{ jackett_port }}:9117"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ restart_policy: unless-stopped
+ memory: "{{ jackett_memory }}"
+ labels:
+ traefik.enable: "{{ jackett_available_externally | string }}"
+ traefik.http.routers.jackett.rule: "Host(`{{ jackett_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.jackett.tls.certresolver: "letsencrypt"
+ traefik.http.routers.jackett.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.jackett.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.jackett.loadbalancer.server.port: "9117"
+ when: jackett_enabled is true
+
+- name: Stop Jackett
+ block:
+ - name: Stop Jackett
+ community.docker.docker_container:
+ name: "{{ jackett_container_name }}"
+ state: absent
+ when: jackett_enabled is false
diff --git a/roles/jellyfin/defaults/main.yml b/roles/jellyfin/defaults/main.yml
index 5306b788..49ec1a11 100644
--- a/roles/jellyfin/defaults/main.yml
+++ b/roles/jellyfin/defaults/main.yml
@@ -29,5 +29,10 @@ jellyfin_hostname: "jellyfin"
jellyfin_port_http: "8896"
jellyfin_port_https: "8928"
+# docker
+jellyfin_container_name: "jellyfin"
+jellyfin_image_name: "linuxserver/jellyfin"
+jellyfin_image_version: "latest"
+
# specs
jellyfin_memory: "1g"
diff --git a/roles/jellyfin/molecule/default/molecule.yml b/roles/jellyfin/molecule/default/molecule.yml
new file mode 100644
index 00000000..d376e663
--- /dev/null
+++ b/roles/jellyfin/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ jellyfin_enabled: true
diff --git a/roles/jellyfin/molecule/default/side_effect.yml b/roles/jellyfin/molecule/default/side_effect.yml
new file mode 100644
index 00000000..a55b26c6
--- /dev/null
+++ b/roles/jellyfin/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ jellyfin_enabled: false
diff --git a/roles/jellyfin/molecule/default/verify.yml b/roles/jellyfin/molecule/default/verify.yml
new file mode 100644
index 00000000..fa07a167
--- /dev/null
+++ b/roles/jellyfin/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get jellyfin container state
+ community.docker.docker_container:
+ name: "{{ jellyfin_container_name }}"
+ register: result
+
+ - name: Check if jellyfin containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/jellyfin/molecule/default/verify_stopped.yml b/roles/jellyfin/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..18552ea8
--- /dev/null
+++ b/roles/jellyfin/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove jellyfin
+ community.docker.docker_container:
+ name: "{{ jellyfin_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if jellyfin is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/jellyfin/tasks/main.yml b/roles/jellyfin/tasks/main.yml
index d7f7ae29..434b624b 100644
--- a/roles/jellyfin/tasks/main.yml
+++ b/roles/jellyfin/tasks/main.yml
@@ -1,37 +1,49 @@
---
-- name: Create Jellyfin Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ jellyfin_config_directory }}"
+- name: Start jellyfin
+ block:
+ - name: Create Jellyfin Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ jellyfin_config_directory }}"
-- name: Jellyfin Docker Container
- docker_container:
- name: jellyfin
- image: linuxserver/jellyfin
- pull: true
- volumes:
- - "{{ jellyfin_config_directory }}:/config:rw"
- - "{{ jellyfin_movies_directory }}:/movies:{{ jellyfin_movies_permissions }}"
- - "{{ jellyfin_music_directory }}:/music:{{ jellyfin_music_permissions }}"
- - "{{ jellyfin_photos_directory }}:/photos:{{ jellyfin_photos_permissions }}"
- - "{{ jellyfin_tv_directory }}:/tv:{{ jellyfin_tv_permissions }}"
- - "{{ jellyfin_books_directory }}:/books:{{ jellyfin_books_permissions }}"
- - "{{ jellyfin_audiobooks_directory }}:/audiobooks:{{ jellyfin_audiobooks_permissions }}"
- ports:
- - "{{ jellyfin_port_http }}:8096"
- - "{{ jellyfin_port_https }}:8920"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ jellyfin_user_id }}"
- PGID: "{{ jellyfin_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ jellyfin_memory }}"
- labels:
- traefik.enable: "{{ jellyfin_available_externally | string }}"
- traefik.http.routers.jellyfin.rule: "Host(`{{ jellyfin_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.jellyfin.tls.certresolver: "letsencrypt"
- traefik.http.routers.jellyfin.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.jellyfin.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.jellyfin.loadbalancer.server.port: "8096"
+ - name: Jellyfin Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ jellyfin_container_name }}"
+ image: "{{ jellyfin_image_name }}:{{ jellyfin_image_version }}"
+ pull: true
+ volumes:
+ - "{{ jellyfin_config_directory }}:/config:rw"
+ - "{{ jellyfin_movies_directory }}:/movies:{{ jellyfin_movies_permissions }}"
+ - "{{ jellyfin_music_directory }}:/music:{{ jellyfin_music_permissions }}"
+ - "{{ jellyfin_photos_directory }}:/photos:{{ jellyfin_photos_permissions }}"
+ - "{{ jellyfin_tv_directory }}:/tv:{{ jellyfin_tv_permissions }}"
+ - "{{ jellyfin_books_directory }}:/books:{{ jellyfin_books_permissions }}"
+ - "{{ jellyfin_audiobooks_directory }}:/audiobooks:{{ jellyfin_audiobooks_permissions }}"
+ ports:
+ - "{{ jellyfin_port_http }}:8096"
+ - "{{ jellyfin_port_https }}:8920"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ jellyfin_user_id }}"
+ PGID: "{{ jellyfin_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ jellyfin_memory }}"
+ labels:
+ traefik.enable: "{{ jellyfin_available_externally | string }}"
+ traefik.http.routers.jellyfin.rule: "Host(`{{ jellyfin_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.jellyfin.tls.certresolver: "letsencrypt"
+ traefik.http.routers.jellyfin.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.jellyfin.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.jellyfin.loadbalancer.server.port: "8096"
+ when: jellyfin_enabled is true
+
+- name: Stop jellyfin
+ block:
+ - name: Stop jellyfin
+ community.docker.docker_container:
+ name: "{{ jellyfin_container_name }}"
+ state: absent
+ when: jellyfin_enabled is false
diff --git a/roles/joomla/defaults/main.yml b/roles/joomla/defaults/main.yml
index cff8308a..87099632 100644
--- a/roles/joomla/defaults/main.yml
+++ b/roles/joomla/defaults/main.yml
@@ -10,6 +10,16 @@ joomla_data_directory: "{{ docker_home }}/joomla"
# network
joomla_port: "8181"
joomla_hostname: "joomla"
+joomla_network_name: "joomla"
+
+# docker
+joomla_container_name: "joomla"
+joomla_image_name: "joomla"
+joomla_image_version: "latest"
+joomla_db_container_name: "joomla-db"
+joomla_db_image_name: "mysql"
+joomla_db_image_version: "5.7"
# specs
joomla_memory: 1g
+joomla_db_memory: 1g
diff --git a/roles/joomla/molecule/default/molecule.yml b/roles/joomla/molecule/default/molecule.yml
new file mode 100644
index 00000000..498a06f6
--- /dev/null
+++ b/roles/joomla/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ joomla_enabled: true
diff --git a/roles/joomla/molecule/default/side_effect.yml b/roles/joomla/molecule/default/side_effect.yml
new file mode 100644
index 00000000..ced35ccf
--- /dev/null
+++ b/roles/joomla/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ joomla_enabled: false
diff --git a/roles/joomla/molecule/default/verify.yml b/roles/joomla/molecule/default/verify.yml
new file mode 100644
index 00000000..728ea20c
--- /dev/null
+++ b/roles/joomla/molecule/default/verify.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get joomla container state
+ community.docker.docker_container:
+ name: "{{ joomla_container_name }}"
+ register: result
+
+ - name: Get joomla db container state
+ community.docker.docker_container:
+ name: "{{ joomla_db_container_name }}"
+ register: result_db
+
+ - name: Check if joomla containers are running
+ ansible.builtin.assert:
+ that:
+ - result_db.container['State']['Status'] == "running"
+ - result_db.container['State']['Restarting'] == false
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/joomla/molecule/default/verify_stopped.yml b/roles/joomla/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..601be521
--- /dev/null
+++ b/roles/joomla/molecule/default/verify_stopped.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove joomla
+ community.docker.docker_container:
+ name: "{{ joomla_container_name }}"
+ state: absent
+ register: result
+
+ - name: Try and stop and remove joomla db
+ community.docker.docker_container:
+ name: "{{ joomla_db_container_name }}"
+ state: absent
+ register: result_db
+
+ - name: Check if joomla is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
+ - not result_db.changed
diff --git a/roles/joomla/tasks/main.yml b/roles/joomla/tasks/main.yml
index 61a82bc0..2dbcfe87 100644
--- a/roles/joomla/tasks/main.yml
+++ b/roles/joomla/tasks/main.yml
@@ -1,47 +1,72 @@
---
-- name: Create Joomla Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ joomla_data_directory }}"
- - "{{ joomla_data_directory }}/db"
+- name: Start Joomla
+ block:
+ - name: Create Joomla Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ joomla_data_directory }}"
+ - "{{ joomla_data_directory }}/db"
-- name: MySQL Docker Container for Joomla
- docker_container:
- name: joomla_mysql
- image: mysql:5.7
- pull: true
- volumes:
- - "{{ joomla_data_directory }}/db:/var/lib/mysql"
- env:
- MYSQL_DATABASE: "joomla"
- MYSQL_USER: "joomla"
- MYSQL_ROOT_PASSWORD: "{{ joomla_database_password }}"
- restart_policy: unless-stopped
- memory: 1g
+ - name: Create Joomla network
+ community.docker.docker_network:
+ name: "{{ joomla_network_name }}"
-- name: Joomla Docker Container
- docker_container:
- name: joomla
- image: joomla
- pull: true
- volumes:
- - "{{ joomla_data_directory }}:/var/www/html:rw"
- ports:
- - "{{ joomla_port }}:80"
- links:
- - "joomla_mysql:mysql"
- env:
- JOOMLA_DB_HOST: "mysql"
- JOOMLA_DB_USER: "root"
- JOOMLA_DB_PASSWORD: "{{ joomla_database_password }}"
- restart_policy: unless-stopped
- memory: "{{ joomla_memory }}"
- labels:
- traefik.enable: "{{ joomla_available_externally | string }}"
- traefik.http.routers.joomla.rule: "Host(`{{ joomla_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.joomla.tls.certresolver: "letsencrypt"
- traefik.http.routers.joomla.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.joomla.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.joomla.loadbalancer.server.port: "80"
+ - name: MySQL Docker Container for Joomla
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ joomla_db_container_name }}"
+ image: "{{ joomla_db_image_name }}:{{ joomla_db_image_version }}"
+ pull: true
+ networks:
+ - name: "{{ joomla_network_name }}"
+ network_mode: "{{ joomla_network_name }}"
+ volumes:
+ - "{{ joomla_data_directory }}/db:/var/lib/mysql"
+ env:
+ MYSQL_DATABASE: "joomla"
+ MYSQL_USER: "joomla"
+ MYSQL_ROOT_PASSWORD: "{{ joomla_database_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ joomla_db_memory }}"
+
+ - name: Joomla Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ joomla_container_name }}"
+ image: "{{ joomla_image_name }}:{{ joomla_image_version }}"
+ pull: true
+ networks:
+ - name: "{{ joomla_network_name }}"
+ network_mode: "{{ joomla_network_name }}"
+ volumes:
+ - "{{ joomla_data_directory }}:/var/www/html:rw"
+ ports:
+ - "{{ joomla_port }}:80"
+ env:
+ JOOMLA_DB_HOST: "{{ joomla_db_container_name }}"
+ JOOMLA_DB_USER: "root"
+ JOOMLA_DB_PASSWORD: "{{ joomla_database_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ joomla_memory }}"
+ labels:
+ traefik.enable: "{{ joomla_available_externally | string }}"
+ traefik.http.routers.joomla.rule: "Host(`{{ joomla_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.joomla.tls.certresolver: "letsencrypt"
+ traefik.http.routers.joomla.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.joomla.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.joomla.loadbalancer.server.port: "80"
+ when: joomla_enabled is true
+
+- name: Stop Joomla
+ block:
+ - name: Stop Joomla
+ community.docker.docker_container:
+ name: "{{ joomla_container_name }}"
+ state: absent
+ - name: Stop Joomla DB
+ community.docker.docker_container:
+ name: "{{ joomla_db_container_name }}"
+ state: absent
+ when: joomla_enabled is false
diff --git a/roles/komga/defaults/main.yml b/roles/komga/defaults/main.yml
index 8a0ed1b7..a1b35f09 100644
--- a/roles/komga/defaults/main.yml
+++ b/roles/komga/defaults/main.yml
@@ -16,5 +16,10 @@ komga_group_id: "1000"
komga_hostname: "komga"
komga_port_http: "8088"
+# docker
+komga_container_name: "komga"
+komga_image_name: "gotson/komga"
+komga_image_version: "latest"
+
# specs
komga_memory: "1g"
diff --git a/roles/komga/molecule/default/molecule.yml b/roles/komga/molecule/default/molecule.yml
new file mode 100644
index 00000000..8b6061b2
--- /dev/null
+++ b/roles/komga/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ komga_enabled: true
diff --git a/roles/komga/molecule/default/side_effect.yml b/roles/komga/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f923232d
--- /dev/null
+++ b/roles/komga/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ komga_enabled: false
diff --git a/roles/komga/molecule/default/verify.yml b/roles/komga/molecule/default/verify.yml
new file mode 100644
index 00000000..aad4abe8
--- /dev/null
+++ b/roles/komga/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get komga container state
+ docker_container_info:
+ name: "{{ komga_container_name }}"
+ register: result
+
+ - name: Check if komga docker container is running
+ assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/komga/molecule/default/verify_stopped.yml b/roles/komga/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..a601c796
--- /dev/null
+++ b/roles/komga/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove komga
+ docker_container:
+ name: "{{ komga_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if komga container is stopped
+ assert:
+ that:
+ - not result.changed
diff --git a/roles/komga/tasks/main.yml b/roles/komga/tasks/main.yml
index 79758cd8..f5daa3b3 100644
--- a/roles/komga/tasks/main.yml
+++ b/roles/komga/tasks/main.yml
@@ -1,36 +1,48 @@
---
-- name: Create Komga Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ komga_data_directory }}"
- - "{{ komga_data_directory }}/config"
+- name: Start Komga
+ block:
+ - name: Create Komga Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ komga_data_directory }}"
+ - "{{ komga_data_directory }}/config"
-- name: Komga Docker Container
- docker_container:
- name: komga
- image: gotson/komga
- pull: true
- volumes:
- - "{{ komga_comics_directory }}:/comics:ro"
- - "{{ komga_books_directory }}:/books:ro"
- - "{{ komga_data_directory }}:/data:rw"
- - "{{ komga_data_directory }}/config:/config:rw"
- network_mode: "bridge"
- ports:
- - "{{ komga_port_http }}:8080"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ komga_user_id }}"
- PGID: "{{ komga_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ komga_memory }}"
- labels:
- traefik.enable: "{{ komga_available_externally | string }}"
- traefik.http.routers.komga.rule: "Host(`{{ komga_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.komga.tls.certresolver: "letsencrypt"
- traefik.http.routers.komga.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.komga.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.komga.loadbalancer.server.port: "8080"
+ - name: Komga Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ komga_container_name }}"
+ image: "{{ komga_image_name }}:{{ komga_image_version }}"
+ pull: true
+ volumes:
+ - "{{ komga_comics_directory }}:/comics:ro"
+ - "{{ komga_books_directory }}:/books:ro"
+ - "{{ komga_data_directory }}:/data:rw"
+ - "{{ komga_data_directory }}/config:/config:rw"
+ network_mode: "bridge"
+ ports:
+ - "{{ komga_port_http }}:8080"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ komga_user_id }}"
+ PGID: "{{ komga_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ komga_memory }}"
+ labels:
+ traefik.enable: "{{ komga_available_externally | string }}"
+ traefik.http.routers.komga.rule: "Host(`{{ komga_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.komga.tls.certresolver: "letsencrypt"
+ traefik.http.routers.komga.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.komga.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.komga.loadbalancer.server.port: "8080"
+ when: komga_enabled is true
+
+- name: Stop Komga
+ block:
+ - name: Stop Komga
+ community.docker.docker_container:
+ name: "{{ komga_container_name }}"
+ state: absent
+ when: komga_enabled is false
diff --git a/roles/krusader/defaults/main.yml b/roles/krusader/defaults/main.yml
index 4f8a59c6..11741ae2 100644
--- a/roles/krusader/defaults/main.yml
+++ b/roles/krusader/defaults/main.yml
@@ -1,9 +1,6 @@
---
krusader_enabled: false
-krusader_available_externally: false
-
-krusader_secure_connection: "0"
-krusader_vnc_password: "topsecret"
+krusader_available_externally: "false"
# uid / gid
krusader_user_id: "0"
@@ -14,9 +11,20 @@ krusader_config_directory: "{{ docker_home }}/krusader/config"
krusader_browse_directory: "/"
# network
-krusader_port_http: "5800"
+krusader_port_http: "6080"
krusader_port_vnc: "5900"
krusader_hostname: "krusader"
+# docker
+krusader_container_name: "krusader"
+krusader_image_name: "binhex/arch-krusader"
+krusader_image_version: "latest"
+
# specs
krusader_memory: 1g
+
+# krusader
+krusader_umask: "000"
+krusader_webpage_title: "Tower"
+krusader_temp_folder: "/config/krusader/tmp"
+krusader_vnc_password: "topsecret"
diff --git a/roles/krusader/molecule/default/molecule.yml b/roles/krusader/molecule/default/molecule.yml
new file mode 100644
index 00000000..8c716607
--- /dev/null
+++ b/roles/krusader/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ krusader_enabled: true
diff --git a/roles/krusader/molecule/default/side_effect.yml b/roles/krusader/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5f5a9c03
--- /dev/null
+++ b/roles/krusader/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ krusader_enabled: false
diff --git a/roles/krusader/molecule/default/verify.yml b/roles/krusader/molecule/default/verify.yml
new file mode 100644
index 00000000..24b6cfb2
--- /dev/null
+++ b/roles/krusader/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get krusader container state
+ docker_container_info:
+ name: "{{ krusader_container_name }}"
+ register: result
+
+ - name: Check if krusader docker container is running
+ assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/krusader/molecule/default/verify_stopped.yml b/roles/krusader/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..081b85ad
--- /dev/null
+++ b/roles/krusader/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove krusader
+ docker_container:
+ name: "{{ krusader_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if krusader container is stopped
+ assert:
+ that:
+ - not result.changed
diff --git a/roles/krusader/tasks/main.yml b/roles/krusader/tasks/main.yml
index d193dadd..36b1c5bd 100644
--- a/roles/krusader/tasks/main.yml
+++ b/roles/krusader/tasks/main.yml
@@ -1,34 +1,48 @@
---
-- name: Krusader Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ krusader_config_directory }}/krusader"
+- name: Start Krusader
+ block:
+ - name: Krusader Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ krusader_config_directory }}/krusader"
-- name: Krusader Docker Container
- docker_container:
- name: krusader
- image: djaydev/krusader:latest
- pull: true
- volumes:
- - "{{ krusader_config_directory }}:/config:rw"
- - "{{ krusader_browse_directory }}:/mnt/fs"
- ports:
- - "{{ krusader_port_http }}:5800"
- - "{{ krusader_port_vnc }}:5900"
- env:
- USER_ID: "{{ krusader_user_id }}"
- GROUP_ID: "{{ krusader_group_id }}"
- SECURE_CONNECTION: "{{ krusader_secure_connection }}"
- TZ: "{{ ansible_nas_timezone }}"
- VNC_PASSWORD: "{{ krusader_vnc_password }}"
- restart_policy: unless-stopped
- memory: "{{ krusader_memory }}"
- labels:
- traefik.enable: "{{ krusader_available_externally }}"
- traefik.http.routers.krusader.rule: "Host(`{{ krusader_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.krusader.tls.certresolver: "letsencrypt"
- traefik.http.routers.krusader.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.krusader.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.krusader.loadbalancer.server.port: "5800"
+ - name: Krusader Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ krusader_container_name }}"
+ image: "{{ krusader_image_name }}:{{ krusader_image_version }}"
+ pull: true
+ privileged: true
+ volumes:
+ - "{{ krusader_config_directory }}:/config:rw"
+ - "{{ krusader_browse_directory }}:/mnt/fs"
+ ports:
+ - "{{ krusader_port_http }}:6080"
+ - "{{ krusader_port_vnc }}:5900"
+ env:
+ PUID: "{{ krusader_user_id }}"
+ PGID: "{{ krusader_group_id }}"
+ VNC_PASSWORD: "{{ krusader_vnc_password }}"
+ TEMP_FOLDER: "{{ krusader_temp_folder }}"
+ WEBPAGE_TITLE: "{{ krusader_webpage_title }}"
+ UMASK: "{{ krusader_umask }}"
+ restart_policy: unless-stopped
+ memory: "{{ krusader_memory }}"
+ labels:
+ traefik.enable: "{{ krusader_available_externally }}"
+ traefik.http.routers.krusader.rule: "Host(`{{ krusader_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.krusader.tls.certresolver: "letsencrypt"
+ traefik.http.routers.krusader.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.krusader.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.krusader.loadbalancer.server.port: "6080"
+ when: krusader_enabled is true
+
+- name: Stop Krusader
+ block:
+ - name: Stop Krusader
+ community.docker.docker_container:
+ name: "{{ krusader_container_name }}"
+ state: absent
+ when: krusader_enabled is false
diff --git a/roles/lidarr/defaults/main.yml b/roles/lidarr/defaults/main.yml
index ac89b710..7d65c8c2 100644
--- a/roles/lidarr/defaults/main.yml
+++ b/roles/lidarr/defaults/main.yml
@@ -15,5 +15,10 @@ lidarr_group_id: "0"
lidarr_port: "8686"
lidarr_hostname: "lidarr"
+# docker
+lidarr_container_name: "lidarr"
+lidarr_image_name: "linuxserver/lidarr"
+lidarr_image_version: "latest"
+
# specs
lidarr_memory: 1g
diff --git a/roles/lidarr/molecule/default/molecule.yml b/roles/lidarr/molecule/default/molecule.yml
new file mode 100644
index 00000000..5881b498
--- /dev/null
+++ b/roles/lidarr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ lidarr_enabled: true
diff --git a/roles/lidarr/molecule/default/side_effect.yml b/roles/lidarr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..9bca21b1
--- /dev/null
+++ b/roles/lidarr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ lidarr_enabled: false
diff --git a/roles/lidarr/molecule/default/verify.yml b/roles/lidarr/molecule/default/verify.yml
new file mode 100644
index 00000000..02df6718
--- /dev/null
+++ b/roles/lidarr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get lidarr container state
+ community.docker.docker_container:
+ name: "{{ lidarr_container_name }}"
+ register: result
+
+ - name: Check if lidarr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/lidarr/molecule/default/verify_stopped.yml b/roles/lidarr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..4fb70127
--- /dev/null
+++ b/roles/lidarr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove lidarr
+ community.docker.docker_container:
+ name: "{{ lidarr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if lidarr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/lidarr/tasks/main.yml b/roles/lidarr/tasks/main.yml
index 8e6fa9ae..abfdccb2 100644
--- a/roles/lidarr/tasks/main.yml
+++ b/roles/lidarr/tasks/main.yml
@@ -1,30 +1,42 @@
---
-- name: Create Lidarr Directory
- file:
- path: "{{ lidarr_data_directory }}"
- state: directory
+- name: Start Lidarr
+ block:
+ - name: Create Lidarr Directory
+ ansible.builtin.file:
+ path: "{{ lidarr_data_directory }}"
+ state: directory
-- name: Lidarr Docker Container
- docker_container:
- name: lidarr
- image: linuxserver/lidarr
- pull: true
- volumes:
- - "{{ lidarr_music_directory }}:/music:rw"
- - "{{ lidarr_downloads_directory }}:/downloads:rw"
- - "{{ lidarr_data_directory }}:/config:rw"
- ports:
- - "{{ lidarr_port }}:8686"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ lidarr_user_id }}"
- PGID: "{{ lidarr_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ lidarr_memory }}"
- labels:
- traefik.enable: "{{ lidarr_available_externally | string }}"
- traefik.http.routers.lidarr.rule: "Host(`{{ lidarr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.lidarr.tls.certresolver: "letsencrypt"
- traefik.http.routers.lidarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.lidarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.lidarr.loadbalancer.server.port: "8686"
+ - name: Lidarr Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ lidarr_container_name }}"
+ image: "{{ lidarr_image_name }}:{{ lidarr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ lidarr_music_directory }}:/music:rw"
+ - "{{ lidarr_downloads_directory }}:/downloads:rw"
+ - "{{ lidarr_data_directory }}:/config:rw"
+ ports:
+ - "{{ lidarr_port }}:8686"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ lidarr_user_id }}"
+ PGID: "{{ lidarr_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ lidarr_memory }}"
+ labels:
+ traefik.enable: "{{ lidarr_available_externally | string }}"
+ traefik.http.routers.lidarr.rule: "Host(`{{ lidarr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.lidarr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.lidarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.lidarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.lidarr.loadbalancer.server.port: "8686"
+ when: lidarr_enabled is true
+
+- name: Stop Lidarr
+ block:
+ - name: Stop Lidarr
+ community.docker.docker_container:
+ name: "{{ lidarr_container_name }}"
+ state: absent
+ when: lidarr_enabled is false
diff --git a/roles/mealie/defaults/main.yml b/roles/mealie/defaults/main.yml
index 9555a134..3a038c7e 100644
--- a/roles/mealie/defaults/main.yml
+++ b/roles/mealie/defaults/main.yml
@@ -13,5 +13,10 @@ mealie_group_id: "1000"
mealie_hostname: "mealie"
mealie_port: "9925"
+# docker
+mealie_container_name: "mealie"
+mealie_image_name: "hkotel/mealie"
+mealie_image_version: "latest"
+
# specs
mealie_memory: 1g
diff --git a/roles/mealie/molecule/default/molecule.yml b/roles/mealie/molecule/default/molecule.yml
new file mode 100644
index 00000000..22adf926
--- /dev/null
+++ b/roles/mealie/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ mealie_enabled: true
diff --git a/roles/mealie/molecule/default/side_effect.yml b/roles/mealie/molecule/default/side_effect.yml
new file mode 100644
index 00000000..53a89e50
--- /dev/null
+++ b/roles/mealie/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ mealie_enabled: false
diff --git a/roles/mealie/molecule/default/verify.yml b/roles/mealie/molecule/default/verify.yml
new file mode 100644
index 00000000..ae2c3603
--- /dev/null
+++ b/roles/mealie/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get mealie container state
+ community.docker.docker_container:
+ name: "{{ mealie_container_name }}"
+ register: result
+
+ - name: Check if mealie containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/mealie/molecule/default/verify_stopped.yml b/roles/mealie/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..1d1abad0
--- /dev/null
+++ b/roles/mealie/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove mealie
+ community.docker.docker_container:
+ name: "{{ mealie_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if mealie is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/mealie/tasks/main.yml b/roles/mealie/tasks/main.yml
index b480eafa..7683d4f7 100644
--- a/roles/mealie/tasks/main.yml
+++ b/roles/mealie/tasks/main.yml
@@ -1,37 +1,49 @@
---
-- name: Create Mealie Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ mealie_data_directory }}/data"
+- name: Start Mealie
+ block:
+ - name: Create Mealie Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ mealie_data_directory }}/data"
-- name: Mealie Docker Container
- docker_container:
- name: mealie
- image: hkotel/mealie:latest
- pull: true
- volumes:
- - "{{ mealie_data_directory }}:/app/data:rw"
- ports:
- - "{{ mealie_port }}:80"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ mealie_user_id }}"
- PGID: "{{ mealie_group_id }}"
- RECIPE_PUBLIC: "true"
- RECIPE_SHOW_NUTRITION: "true"
- RECIPE_SHOW_ASSETS: "true"
- RECIPE_LANDSCAPE_VIEW: "true"
- RECIPE_DISABLE_COMMENTS: "false"
- RECIPE_DISABLE_AMOUNT: "false"
- BASE_URL: "{{ ansible_nas_domain }}:{{ mealie_port }}"
- restart_policy: unless-stopped
- memory: "{{ mealie_memory }}"
- labels:
- traefik.enable: "{{ mealie_available_externally | string }}"
- traefik.http.routers.mealie.rule: "Host(`{{ mealie_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.mealie.tls.certresolver: "letsencrypt"
- traefik.http.routers.mealie.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.mealie.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.mealie.loadbalancer.server.port: "80"
+ - name: Mealie Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ mealie_container_name }}"
+ image: "{{ mealie_image_name }}:{{ mealie_image_version }}"
+ pull: true
+ volumes:
+ - "{{ mealie_data_directory }}:/app/data:rw"
+ ports:
+ - "{{ mealie_port }}:80"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ mealie_user_id }}"
+ PGID: "{{ mealie_group_id }}"
+ RECIPE_PUBLIC: "true"
+ RECIPE_SHOW_NUTRITION: "true"
+ RECIPE_SHOW_ASSETS: "true"
+ RECIPE_LANDSCAPE_VIEW: "true"
+ RECIPE_DISABLE_COMMENTS: "false"
+ RECIPE_DISABLE_AMOUNT: "false"
+ BASE_URL: "{{ ansible_nas_domain }}:{{ mealie_port }}"
+ restart_policy: unless-stopped
+ memory: "{{ mealie_memory }}"
+ labels:
+ traefik.enable: "{{ mealie_available_externally | string }}"
+ traefik.http.routers.mealie.rule: "Host(`{{ mealie_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.mealie.tls.certresolver: "letsencrypt"
+ traefik.http.routers.mealie.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.mealie.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.mealie.loadbalancer.server.port: "80"
+ when: mealie_enabled is true
+
+- name: Stop Mealie
+ block:
+ - name: Stop Mealie
+ community.docker.docker_container:
+ name: "{{ mealie_container_name }}"
+ state: absent
+ when: mealie_enabled is false
diff --git a/roles/minecraft-server/defaults/main.yml b/roles/minecraft-server/defaults/main.yml
index 4fee052b..6f29ebaf 100644
--- a/roles/minecraft-server/defaults/main.yml
+++ b/roles/minecraft-server/defaults/main.yml
@@ -6,3 +6,8 @@ minecraft_server_data_directory: "{{ docker_home }}/minecraft_server"
# network
minecraft_server_port: "25565"
+
+# docker
+minecraft_server_container_name: "minecraft-server"
+minecraft_server_image_name: "itzg/minecraft-server"
+minecraft_server_image_version: "latest"
diff --git a/roles/minecraft-server/molecule/default/molecule.yml b/roles/minecraft-server/molecule/default/molecule.yml
new file mode 100644
index 00000000..b1b89a83
--- /dev/null
+++ b/roles/minecraft-server/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ minecraft_server_enabled: true
diff --git a/roles/minecraft-server/molecule/default/side_effect.yml b/roles/minecraft-server/molecule/default/side_effect.yml
new file mode 100644
index 00000000..e098c995
--- /dev/null
+++ b/roles/minecraft-server/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ minecraft_server_enabled: false
diff --git a/roles/minecraft-server/molecule/default/verify.yml b/roles/minecraft-server/molecule/default/verify.yml
new file mode 100644
index 00000000..5a145c44
--- /dev/null
+++ b/roles/minecraft-server/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get minecraft_server container state
+ community.docker.docker_container:
+ name: "{{ minecraft_server_container_name }}"
+ register: result
+
+ - name: Check if minecraft_server containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/minecraft-server/molecule/default/verify_stopped.yml b/roles/minecraft-server/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f8956727
--- /dev/null
+++ b/roles/minecraft-server/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove minecraft_server
+ community.docker.docker_container:
+ name: "{{ minecraft_server_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if minecraft_server is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/minecraft-server/tasks/main.yml b/roles/minecraft-server/tasks/main.yml
index b3d721fb..a7be6228 100644
--- a/roles/minecraft-server/tasks/main.yml
+++ b/roles/minecraft-server/tasks/main.yml
@@ -1,20 +1,32 @@
---
-- name: Create Minecraft Server Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ minecraft_server_data_directory }}"
+- name: Start Minecraft Server
+ block:
+ - name: Create Minecraft Server Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ minecraft_server_data_directory }}"
-- name: Minecraft Server Docker Container
- docker_container:
- name: minecraft-server
- image: itzg/minecraft-server:latest
- pull: true
- volumes:
- - "{{ minecraft_server_data_directory }}:/data:rw"
- ports:
- - "{{ minecraft_server_port }}:25565"
- env:
- EULA: "TRUE"
- restart_policy: unless-stopped
+ - name: Minecraft Server Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ minecraft_server_container_name }}"
+ image: "{{ minecraft_server_image_name }}:{{ minecraft_server_image_version }}"
+ pull: true
+ volumes:
+ - "{{ minecraft_server_data_directory }}:/data:rw"
+ ports:
+ - "{{ minecraft_server_port }}:25565"
+ env:
+ EULA: "TRUE"
+ restart_policy: unless-stopped
+ when: minecraft_server_enabled is true
+
+- name: Stop Minecraft Server
+ block:
+ - name: Stop Minecraft Server
+ community.docker.docker_container:
+ name: "{{ minecraft_server_container_name }}"
+ state: absent
+ when: minecraft_server_enabled is false
diff --git a/roles/minidlna/defaults/main.yml b/roles/minidlna/defaults/main.yml
index fa29e4cf..4fe223f8 100644
--- a/roles/minidlna/defaults/main.yml
+++ b/roles/minidlna/defaults/main.yml
@@ -11,5 +11,10 @@ minidlna_media_directory2: "{{ tv_root }}"
minidlna_friendly_name: "{{ ansible_nas_hostname }}"
minidlna_port: "8201"
+# docker
+minidlna_container_name: "minidnla"
+minidlna_image_name: "vladgh/minidlna"
+minidlna_image_version: "latest"
+
# specs
minidlna_memory: "1g"
diff --git a/roles/minidlna/molecule/default/molecule.yml b/roles/minidlna/molecule/default/molecule.yml
new file mode 100644
index 00000000..45dcbcbf
--- /dev/null
+++ b/roles/minidlna/molecule/default/molecule.yml
@@ -0,0 +1,7 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ minidlna_enabled: true
+ ansible_nas_hostname: ansible-nas
diff --git a/roles/minidlna/molecule/default/side_effect.yml b/roles/minidlna/molecule/default/side_effect.yml
new file mode 100644
index 00000000..8aa2b5ba
--- /dev/null
+++ b/roles/minidlna/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ minidlna_enabled: false
diff --git a/roles/minidlna/molecule/default/verify.yml b/roles/minidlna/molecule/default/verify.yml
new file mode 100644
index 00000000..7cad6a8c
--- /dev/null
+++ b/roles/minidlna/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get minidlna container state
+ community.docker.docker_container:
+ name: "{{ minidlna_container_name }}"
+ register: result
+
+ - name: Check if minidlna containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/minidlna/molecule/default/verify_stopped.yml b/roles/minidlna/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..cb144af7
--- /dev/null
+++ b/roles/minidlna/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove minidlna
+ community.docker.docker_container:
+ name: "{{ minidlna_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if minidlna is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/minidlna/tasks/main.yml b/roles/minidlna/tasks/main.yml
index 8feb8ebd..513c9696 100644
--- a/roles/minidlna/tasks/main.yml
+++ b/roles/minidlna/tasks/main.yml
@@ -1,17 +1,29 @@
---
-- name: MiniDLNA Docker Container
- docker_container:
- name: minidlna
- image: vladgh/minidlna
- pull: true
- volumes:
- - "{{ minidlna_media_directory1 }}:/media1:rw"
- - "{{ minidlna_media_directory2 }}:/media2:rw"
- env:
- MINIDLNA_MEDIA_DIR1: "/media1"
- MINIDLNA_MEDIA_DIR2: "/media2"
- MINIDLNA_FRIENDLY_NAME: "{{ minidlna_friendly_name }}"
- MINIDLNA_PORT: "{{ minidlna_port }}"
- restart_policy: unless-stopped
- network_mode: host
- memory: "{{ minidlna_memory }}"
+- name: Start MiniDLNA
+ block:
+ - name: MiniDLNA Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ minidlna_container_name }}"
+ image: "{{ minidlna_image_name }}:{{ minidlna_image_version }}"
+ pull: true
+ volumes:
+ - "{{ minidlna_media_directory1 }}:/media1:rw"
+ - "{{ minidlna_media_directory2 }}:/media2:rw"
+ env:
+ MINIDLNA_MEDIA_DIR1: "/media1"
+ MINIDLNA_MEDIA_DIR2: "/media2"
+ MINIDLNA_FRIENDLY_NAME: "{{ minidlna_friendly_name }}"
+ MINIDLNA_PORT: "{{ minidlna_port }}"
+ restart_policy: unless-stopped
+ network_mode: host
+ memory: "{{ minidlna_memory }}"
+ when: minidlna_enabled is true
+
+- name: Stop MiniDLNA
+ block:
+ - name: Stop MiniDLNA
+ community.docker.docker_container:
+ name: "{{ minidlna_container_name }}"
+ state: absent
+ when: minidlna_enabled is false
diff --git a/roles/miniflux/defaults/main.yml b/roles/miniflux/defaults/main.yml
index 40a3caa6..b89a8fc4 100644
--- a/roles/miniflux/defaults/main.yml
+++ b/roles/miniflux/defaults/main.yml
@@ -12,8 +12,17 @@ miniflux_admin_password: supersecure
# network
miniflux_hostname: "miniflux"
+miniflux_network_name: "miniflux"
miniflux_port: "8070"
+# docker
+miniflux_container_name: "miniflux"
+miniflux_image_name: "miniflux/miniflux"
+miniflux_image_version: "latest"
+miniflux_db_container_name: "miniflux-postgres"
+miniflux_db_image_name: "postgres"
+miniflux_db_image_version: "11.1"
+
# specs
miniflux_memory: "1g"
miniflux_postgres_memory: "1g"
diff --git a/roles/miniflux/molecule/default/molecule.yml b/roles/miniflux/molecule/default/molecule.yml
new file mode 100644
index 00000000..281aaf2a
--- /dev/null
+++ b/roles/miniflux/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ miniflux_enabled: true
diff --git a/roles/miniflux/molecule/default/side_effect.yml b/roles/miniflux/molecule/default/side_effect.yml
new file mode 100644
index 00000000..2f1a23d1
--- /dev/null
+++ b/roles/miniflux/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ miniflux_enabled: false
diff --git a/roles/miniflux/molecule/default/verify.yml b/roles/miniflux/molecule/default/verify.yml
new file mode 100644
index 00000000..89bb48fd
--- /dev/null
+++ b/roles/miniflux/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get miniflux container state
+ community.docker.docker_container:
+ name: "{{ miniflux_container_name }}"
+ register: result
+
+ - name: Check if miniflux containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/miniflux/molecule/default/verify_stopped.yml b/roles/miniflux/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..05382c5d
--- /dev/null
+++ b/roles/miniflux/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove miniflux
+ community.docker.docker_container:
+ name: "{{ miniflux_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if miniflux is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/miniflux/tasks/main.yml b/roles/miniflux/tasks/main.yml
index 969f3585..f70b1c91 100644
--- a/roles/miniflux/tasks/main.yml
+++ b/roles/miniflux/tasks/main.yml
@@ -1,45 +1,66 @@
---
-- name: Create Miniflux Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ miniflux_data_directory }}/postgres"
+- name: Start Miniflux
+ block:
+ - name: Create Miniflux Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ miniflux_data_directory }}/postgres"
-- name: Create Postgres for Miniflux
- docker_container:
- name: miniflux-postgres
- image: postgres:11.1
- pull: true
- volumes:
- - "{{ miniflux_data_directory }}/postgres:/var/lib/postgresql/data:rw"
- env:
- POSTGRES_USER: "miniflux"
- POSTGRES_PASSWORD: "supersecure"
- restart_policy: unless-stopped
- memory: "{{ miniflux_postgres_memory }}"
+ - name: Create Miniflux network
+ community.docker.docker_network:
+ name: "{{ miniflux_network_name }}"
-- name: Create Miniflux Docker Container
- docker_container:
- name: miniflux
- image: miniflux/miniflux:latest
- pull: true
- links:
- - miniflux-postgres:db
- ports:
- - "{{ miniflux_port }}:8080"
- env:
- DATABASE_URL: "postgres://miniflux:supersecure@db/miniflux?sslmode=disable"
- RUN_MIGRATIONS: "1"
- CREATE_ADMIN: "1"
- ADMIN_USERNAME: "{{ miniflux_admin_username }}"
- ADMIN_PASSWORD: "{{ miniflux_admin_password }}"
- restart_policy: unless-stopped
- memory: "{{ miniflux_memory }}"
- labels:
- traefik.enable: "{{ miniflux_available_externally | string }}"
- traefik.http.routers.miniflux.rule: "Host(`{{ miniflux_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.miniflux.tls.certresolver: "letsencrypt"
- traefik.http.routers.miniflux.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.miniflux.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.miniflux.loadbalancer.server.port: "8080"
+ - name: Create Postgres for Miniflux
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ miniflux_db_container_name }}"
+ image: "{{ miniflux_db_image_name }}:{{ miniflux_db_image_version }}"
+ pull: true
+ networks:
+ - name: "{{ miniflux_network_name }}"
+ network_mode: "{{ miniflux_network_name }}"
+ volumes:
+ - "{{ miniflux_data_directory }}/postgres:/var/lib/postgresql/data:rw"
+ env:
+ POSTGRES_USER: "miniflux"
+ POSTGRES_PASSWORD: "supersecure"
+ restart_policy: unless-stopped
+ memory: "{{ miniflux_postgres_memory }}"
+
+ - name: Create Miniflux Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ miniflux_container_name }}"
+ image: "{{ miniflux_image_name }}:{{ miniflux_image_version }}"
+ pull: true
+ networks:
+ - name: "{{ miniflux_network_name }}"
+ network_mode: "{{ miniflux_network_name }}"
+ ports:
+ - "{{ miniflux_port }}:8080"
+ env:
+ DATABASE_URL: "postgres://miniflux:supersecure@{{ miniflux_db_container_name }}/miniflux?sslmode=disable"
+ RUN_MIGRATIONS: "1"
+ CREATE_ADMIN: "1"
+ ADMIN_USERNAME: "{{ miniflux_admin_username }}"
+ ADMIN_PASSWORD: "{{ miniflux_admin_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ miniflux_memory }}"
+ labels:
+ traefik.enable: "{{ miniflux_available_externally | string }}"
+ traefik.http.routers.miniflux.rule: "Host(`{{ miniflux_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.miniflux.tls.certresolver: "letsencrypt"
+ traefik.http.routers.miniflux.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.miniflux.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.miniflux.loadbalancer.server.port: "8080"
+ when: miniflux_enabled is true
+
+- name: Stop Miniflux
+ block:
+ - name: Stop Miniflux
+ community.docker.docker_container:
+ name: "{{ miniflux_container_name }}"
+ state: absent
+ when: miniflux_enabled is false
diff --git a/roles/mosquitto/defaults/main.yml b/roles/mosquitto/defaults/main.yml
index f1aa88a6..0060d18a 100644
--- a/roles/mosquitto/defaults/main.yml
+++ b/roles/mosquitto/defaults/main.yml
@@ -12,5 +12,10 @@ mosquitto_group_id: "0"
mosquitto_port_a: "1883"
mosquitto_port_b: "9001"
+# docker
+mosquitto_container_name: "mosquitto"
+mosquitto_image_name: "eclipse-mosquitto"
+mosquitto_image_version: "latest"
+
# specs
mosquitto_memory: 1g
diff --git a/roles/mosquitto/molecule/default/molecule.yml b/roles/mosquitto/molecule/default/molecule.yml
new file mode 100644
index 00000000..0cbf69e3
--- /dev/null
+++ b/roles/mosquitto/molecule/default/molecule.yml
@@ -0,0 +1,16 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ mosquitto_enabled: true
+ mosquitto_data_directory: "/tmp/mosquitto"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp:rw
+ privileged: true
+ pre_build_image: true
diff --git a/roles/mosquitto/molecule/default/side_effect.yml b/roles/mosquitto/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5b4097e6
--- /dev/null
+++ b/roles/mosquitto/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ mosquitto_enabled: false
diff --git a/roles/mosquitto/molecule/default/verify.yml b/roles/mosquitto/molecule/default/verify.yml
new file mode 100644
index 00000000..0656648d
--- /dev/null
+++ b/roles/mosquitto/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get mosquitto container state
+ community.docker.docker_container:
+ name: "{{ mosquitto_container_name }}"
+ register: result
+
+ - name: Check if mosquitto containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/mosquitto/molecule/default/verify_stopped.yml b/roles/mosquitto/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..f7e040cc
--- /dev/null
+++ b/roles/mosquitto/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove mosquitto
+ community.docker.docker_container:
+ name: "{{ mosquitto_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if mosquitto is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/mosquitto/tasks/main.yml b/roles/mosquitto/tasks/main.yml
index aa787c77..94421845 100644
--- a/roles/mosquitto/tasks/main.yml
+++ b/roles/mosquitto/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create Mosquitto Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ mosquitto_data_directory }}/config"
- - "{{ mosquitto_data_directory }}/data"
- - "{{ mosquitto_data_directory }}/log"
+- name: Start Mosquitto
+ block:
+ - name: Create Mosquitto Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ mosquitto_data_directory }}/config"
+ - "{{ mosquitto_data_directory }}/data"
+ - "{{ mosquitto_data_directory }}/log"
-- name: Template mosquitto.conf
- copy:
- src: mosquitto.conf
- dest: "{{ mosquitto_data_directory }}/config/mosquitto.conf"
- register: mosquitto_conf
+ - name: Template mosquitto.conf
+ ansible.builtin.copy:
+ src: mosquitto.conf
+ dest: "{{ mosquitto_data_directory }}/config/mosquitto.conf"
+ register: mosquitto_conf
-- name: Create Mosquitto container
- docker_container:
- name: mosquitto
- image: eclipse-mosquitto:latest
- pull: true
- volumes:
- - "{{ mosquitto_data_directory }}/config/mosquitto.conf:/mosquitto/config/mosquitto.conf:rw"
- - "{{ mosquitto_data_directory }}/data:/mosquitto/data:rw"
- - "{{ mosquitto_data_directory }}/log:/mosquitto/log:rw"
- ports:
- - "{{ mosquitto_port_a }}:1883"
- - "{{ mosquitto_port_b }}:9001"
- restart_policy: unless-stopped
- restart: "{{ mosquitto_conf is changed }}"
- memory: 1g
+ - name: Create Mosquitto container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ mosquitto_container_name }}"
+ image: "{{ mosquitto_image_name }}:{{ mosquitto_image_version }}"
+ pull: true
+ volumes:
+ - "{{ mosquitto_data_directory }}/config/mosquitto.conf:/mosquitto/config/mosquitto.conf:rw"
+ - "{{ mosquitto_data_directory }}/data:/mosquitto/data:rw"
+ - "{{ mosquitto_data_directory }}/log:/mosquitto/log:rw"
+ ports:
+ - "{{ mosquitto_port_a }}:1883"
+ - "{{ mosquitto_port_b }}:9001"
+ restart_policy: unless-stopped
+ restart: "{{ mosquitto_conf is changed }}"
+ memory: 1g
+ when: mosquitto_enabled is true
+
+- name: Stop Mosquitto
+ block:
+ - name: Stop Mosquitto
+ community.docker.docker_container:
+ name: "{{ mosquitto_container_name }}"
+ state: absent
+ when: mosquitto_enabled is false
diff --git a/roles/mylar/defaults/main.yml b/roles/mylar/defaults/main.yml
index ad073aac..f91212e2 100644
--- a/roles/mylar/defaults/main.yml
+++ b/roles/mylar/defaults/main.yml
@@ -16,5 +16,10 @@ mylar_group_id: "0"
mylar_hostname: "mylar"
mylar_port_http: "8585"
+# docker
+mylar_container_name: "mylar"
+mylar_image_name: "linuxserver/mylar"
+mylar_image_version: "latest"
+
# specs
mylar_memory: "1g"
diff --git a/roles/mylar/molecule/default/molecule.yml b/roles/mylar/molecule/default/molecule.yml
new file mode 100644
index 00000000..8eb0e567
--- /dev/null
+++ b/roles/mylar/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ mylar_enabled: true
diff --git a/roles/mylar/molecule/default/side_effect.yml b/roles/mylar/molecule/default/side_effect.yml
new file mode 100644
index 00000000..bf19034e
--- /dev/null
+++ b/roles/mylar/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ mylar_enabled: false
diff --git a/roles/mylar/molecule/default/verify.yml b/roles/mylar/molecule/default/verify.yml
new file mode 100644
index 00000000..fb17cd41
--- /dev/null
+++ b/roles/mylar/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get mylar container state
+ community.docker.docker_container:
+ name: "{{ mylar_container_name }}"
+ register: result
+
+ - name: Check if mylar containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/mylar/molecule/default/verify_stopped.yml b/roles/mylar/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..8d3cf8a7
--- /dev/null
+++ b/roles/mylar/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove mylar
+ community.docker.docker_container:
+ name: "{{ mylar_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if mylar is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/mylar/tasks/main.yml b/roles/mylar/tasks/main.yml
index c7e1e240..16d4f97d 100644
--- a/roles/mylar/tasks/main.yml
+++ b/roles/mylar/tasks/main.yml
@@ -1,34 +1,46 @@
---
-- name: Create Mylar Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ mylar_data_directory }}/config"
+- name: Start Mylar
+ block:
+ - name: Create Mylar Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ mylar_data_directory }}/config"
-- name: Mylar Docker Container
- docker_container:
- name: mylar
- image: linuxserver/mylar
- pull: true
- volumes:
- - "{{ mylar_comics_directory }}:/comics:rw"
- - "{{ mylar_downloads_directory }}:/downloads:rw"
- - "{{ mylar_data_directory }}/config:/config:rw"
- network_mode: "bridge"
- ports:
- - "{{ mylar_port_http }}:8090"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ mylar_user_id }}"
- PGID: "{{ mylar_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ mylar_memory }}"
- labels:
- traefik.enable: "{{ mylar_available_externally | string }}"
- traefik.http.routers.mylar.rule: "Host(`{{ mylar_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.mylar.tls.certresolver: "letsencrypt"
- traefik.http.routers.mylar.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.mylar.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.mylar.loadbalancer.server.port: "8090"
+ - name: Mylar Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ mylar_container_name }}"
+ image: "{{ mylar_image_name }}:{{ mylar_image_version }}"
+ pull: true
+ volumes:
+ - "{{ mylar_comics_directory }}:/comics:rw"
+ - "{{ mylar_downloads_directory }}:/downloads:rw"
+ - "{{ mylar_data_directory }}/config:/config:rw"
+ network_mode: "bridge"
+ ports:
+ - "{{ mylar_port_http }}:8090"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ mylar_user_id }}"
+ PGID: "{{ mylar_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ mylar_memory }}"
+ labels:
+ traefik.enable: "{{ mylar_available_externally | string }}"
+ traefik.http.routers.mylar.rule: "Host(`{{ mylar_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.mylar.tls.certresolver: "letsencrypt"
+ traefik.http.routers.mylar.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.mylar.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.mylar.loadbalancer.server.port: "8090"
+ when: mylar_enabled is true
+
+- name: Stop Mylar
+ block:
+ - name: Stop Mylar
+ community.docker.docker_container:
+ name: "{{ mylar_container_name }}"
+ state: absent
+ when: mylar_enabled is false
diff --git a/roles/mymediaforalexa/defaults/main.yml b/roles/mymediaforalexa/defaults/main.yml
index 048b4010..f95a7ec0 100644
--- a/roles/mymediaforalexa/defaults/main.yml
+++ b/roles/mymediaforalexa/defaults/main.yml
@@ -6,5 +6,10 @@ mymediaforalexa_enabled: false
mymediaforalexa_media_directory: "{{ music_root }}"
mymediaforalexa_data_directory: "{{ docker_home }}/mymediaforalexa"
+# docker
+mymediaforalexa_container_name: "mymediaforalexa"
+mymediaforalexa_image_name: "bizmodeller/mymediaforalexa"
+mymediaforalexa_image_version: "latest"
+
# specs
mymediaforalexa_memory: "1g"
diff --git a/roles/mymediaforalexa/molecule/default/molecule.yml b/roles/mymediaforalexa/molecule/default/molecule.yml
new file mode 100644
index 00000000..da34cf39
--- /dev/null
+++ b/roles/mymediaforalexa/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ mymediaforalexa_enabled: true
diff --git a/roles/mymediaforalexa/molecule/default/side_effect.yml b/roles/mymediaforalexa/molecule/default/side_effect.yml
new file mode 100644
index 00000000..c08d3232
--- /dev/null
+++ b/roles/mymediaforalexa/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ mymediaforalexa_enabled: false
diff --git a/roles/mymediaforalexa/molecule/default/verify.yml b/roles/mymediaforalexa/molecule/default/verify.yml
new file mode 100644
index 00000000..c9a5e4bd
--- /dev/null
+++ b/roles/mymediaforalexa/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get mymediaforalexa container state
+ community.docker.docker_container:
+ name: "{{ mymediaforalexa_container_name }}"
+ register: result
+
+ - name: Check if mymediaforalexa containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/mymediaforalexa/molecule/default/verify_stopped.yml b/roles/mymediaforalexa/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..6d26c297
--- /dev/null
+++ b/roles/mymediaforalexa/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove mymediaforalexa
+ community.docker.docker_container:
+ name: "{{ mymediaforalexa_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if mymediaforalexa is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/mymediaforalexa/tasks/main.yml b/roles/mymediaforalexa/tasks/main.yml
index 4c2264d7..540e6aba 100644
--- a/roles/mymediaforalexa/tasks/main.yml
+++ b/roles/mymediaforalexa/tasks/main.yml
@@ -1,20 +1,32 @@
---
-- name: Create Mymediaforalexa Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ mymediaforalexa_media_directory }}"
- - "{{ mymediaforalexa_data_directory }}"
+- name: Start Mymediaforalexa
+ block:
+ - name: Create Mymediaforalexa Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ mymediaforalexa_media_directory }}"
+ - "{{ mymediaforalexa_data_directory }}"
-- name: Mymediaforalexa Docker Container
- docker_container:
- name: mymediaforalexa
- image: bizmodeller/mymediaforalexa
- pull: true
- volumes:
- - "{{ mymediaforalexa_media_directory }}:/medialibrary:rw"
- - "{{ mymediaforalexa_data_directory }}:/datadir:rw"
- network_mode: host
- restart_policy: unless-stopped
- memory: "{{ mymediaforalexa_memory }}"
+ - name: Mymediaforalexa Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ mymediaforalexa_container_name }}"
+ image: "{{ mymediaforalexa_image_name }}:{{ mymediaforalexa_image_version }}"
+ pull: true
+ volumes:
+ - "{{ mymediaforalexa_media_directory }}:/medialibrary:rw"
+ - "{{ mymediaforalexa_data_directory }}:/datadir:rw"
+ network_mode: host
+ restart_policy: unless-stopped
+ memory: "{{ mymediaforalexa_memory }}"
+ when: mymediaforalexa_enabled is true
+
+- name: Stop Mymediaforalexa
+ block:
+ - name: Stop Mymediaforalexa
+ community.docker.docker_container:
+ name: "{{ mymediaforalexa_container_name }}"
+ state: absent
+ when: mymediaforalexa_enabled is false
diff --git a/roles/n8n/defaults/main.yml b/roles/n8n/defaults/main.yml
index eec83925..aebb7fa1 100644
--- a/roles/n8n/defaults/main.yml
+++ b/roles/n8n/defaults/main.yml
@@ -13,5 +13,10 @@ n8n_data_directory: "{{ docker_home }}/n8n"
n8n_basic_auth_user: "n8n_user"
n8n_basic_auth_password: "n8n_change_me"
+# docker
+n8n_container_name: "n8n"
+n8n_image_name: "n8nio/n8n"
+n8n_image_version: "latest"
+
# specs
n8n_memory: 1g
diff --git a/roles/n8n/molecule/default/molecule.yml b/roles/n8n/molecule/default/molecule.yml
new file mode 100644
index 00000000..3ae3f608
--- /dev/null
+++ b/roles/n8n/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ n8n_enabled: true
diff --git a/roles/n8n/molecule/default/side_effect.yml b/roles/n8n/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5e5f2fb2
--- /dev/null
+++ b/roles/n8n/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ n8n_enabled: false
diff --git a/roles/n8n/molecule/default/verify.yml b/roles/n8n/molecule/default/verify.yml
new file mode 100644
index 00000000..3ea8d266
--- /dev/null
+++ b/roles/n8n/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get n8n container state
+ community.docker.docker_container:
+ name: "{{ n8n_container_name }}"
+ register: result
+
+ - name: Check if n8n containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/n8n/molecule/default/verify_stopped.yml b/roles/n8n/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..e6081311
--- /dev/null
+++ b/roles/n8n/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove n8n
+ community.docker.docker_container:
+ name: "{{ n8n_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if n8n is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/n8n/tasks/main.yml b/roles/n8n/tasks/main.yml
index 8d6fd8a2..f2b59ca0 100644
--- a/roles/n8n/tasks/main.yml
+++ b/roles/n8n/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create n8n Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ n8n_data_directory }}"
+- name: Start n8n
+ block:
+ - name: Create n8n Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ n8n_data_directory }}"
-- name: Create n8n Docker Container
- docker_container:
- name: n8n
- image: n8nio/n8n
- pull: true
- ports:
- - "{{ n8n_port }}:5678"
- volumes:
- - "{{ n8n_data_directory }}:/home/node/.n8n:rw"
- - "/etc/timezone:/etc/timezone:ro"
- restart_policy: unless-stopped
- memory: "{{ n8n_memory }}"
- env:
- N8N_BASIC_AUTH_ACTIVE: "true"
- N8N_BASIC_AUTH_USER: "{{ n8n_basic_auth_user }}"
- N8N_BASIC_AUTH_PASSWORD: "{{ n8n_basic_auth_password }}"
- labels:
- traefik.enable: "{{ n8n_available_externally | string }}"
- traefik.http.routers.n8n.rule: "Host(`{{ n8n_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.n8n.tls.certresolver: "letsencrypt"
- traefik.http.routers.n8n.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.n8n.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.n8n.loadbalancer.server.port: "5678"
+ - name: Create n8n Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ n8n_container_name }}"
+ image: "{{ n8n_image_name }}:{{ n8n_image_version }}"
+ pull: true
+ ports:
+ - "{{ n8n_port }}:5678"
+ volumes:
+ - "{{ n8n_data_directory }}:/home/node/.n8n:rw"
+ - "/etc/timezone:/etc/timezone:ro"
+ restart_policy: unless-stopped
+ memory: "{{ n8n_memory }}"
+ env:
+ N8N_BASIC_AUTH_ACTIVE: "true"
+ N8N_BASIC_AUTH_USER: "{{ n8n_basic_auth_user }}"
+ N8N_BASIC_AUTH_PASSWORD: "{{ n8n_basic_auth_password }}"
+ labels:
+ traefik.enable: "{{ n8n_available_externally | string }}"
+ traefik.http.routers.n8n.rule: "Host(`{{ n8n_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.n8n.tls.certresolver: "letsencrypt"
+ traefik.http.routers.n8n.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.n8n.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.n8n.loadbalancer.server.port: "5678"
+ when: n8n_enabled is true
+
+- name: Stop n8n
+ block:
+ - name: Stop n8n
+ community.docker.docker_container:
+ name: "{{ n8n_container_name }}"
+ state: absent
+ when: n8n_enabled is false
diff --git a/roles/navidrome/defaults/main.yml b/roles/navidrome/defaults/main.yml
index a5c894a8..9bb81403 100644
--- a/roles/navidrome/defaults/main.yml
+++ b/roles/navidrome/defaults/main.yml
@@ -10,6 +10,11 @@ navidrome_music_directory: "{{ music_root }}"
navidrome_port: "4533"
navidrome_hostname: "navidrome"
+# docker
+navidrome_container_name: "navidrome"
+navidrome_image_name: "deluan/navidrome"
+navidrome_image_version: "latest"
+
# specs
navidrome_memory: 1g
diff --git a/roles/navidrome/molecule/default/molecule.yml b/roles/navidrome/molecule/default/molecule.yml
new file mode 100644
index 00000000..0b83fc56
--- /dev/null
+++ b/roles/navidrome/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ navidrome_enabled: true
diff --git a/roles/navidrome/molecule/default/side_effect.yml b/roles/navidrome/molecule/default/side_effect.yml
new file mode 100644
index 00000000..302d634f
--- /dev/null
+++ b/roles/navidrome/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ navidrome_enabled: false
diff --git a/roles/navidrome/molecule/default/verify.yml b/roles/navidrome/molecule/default/verify.yml
new file mode 100644
index 00000000..e791e779
--- /dev/null
+++ b/roles/navidrome/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get navidrome container state
+ community.docker.docker_container:
+ name: "{{ navidrome_container_name }}"
+ register: result
+
+ - name: Check if navidrome containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/navidrome/molecule/default/verify_stopped.yml b/roles/navidrome/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..b26f69ba
--- /dev/null
+++ b/roles/navidrome/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove navidrome
+ community.docker.docker_container:
+ name: "{{ navidrome_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if navidrome is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/navidrome/tasks/main.yml b/roles/navidrome/tasks/main.yml
index 9913c807..c4a8e92e 100644
--- a/roles/navidrome/tasks/main.yml
+++ b/roles/navidrome/tasks/main.yml
@@ -1,35 +1,47 @@
---
-- name: Create Navidrome Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ navidrome_data_directory }}/data"
- - "{{ navidrome_data_directory }}/playlists"
+- name: Start Navidrome
+ block:
+ - name: Create Navidrome Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ navidrome_data_directory }}/data"
+ - "{{ navidrome_data_directory }}/playlists"
-- name: Navidrome Docker Container
- docker_container:
- name: navidrome
- image: deluan/navidrome:latest
- pull: true
- volumes:
- - "{{ navidrome_data_directory }}/data:/navidrome/data:rw"
- - "{{ navidrome_music_directory }}:/navidrome/music:rw"
- ports:
- - "{{ navidrome_port }}:4533"
- env:
- ND_MUSICFOLDER: "/navidrome/music"
- ND_DATAFOLDER: "/navidrome/data"
- ND_SCANSCHEDULE: "{{ navidrome_scan_schedule }}"
- ND_LOGLEVEL: "{{ navidrome_log_level }}"
- ND_SESSIONTIMEOUT: "{{ navidrome_session_timeout }}"
- restart_policy: unless-stopped
- memory: "{{ navidrome_memory }}"
- labels:
- traefik.enable: "{{ navidrome_available_externally | string }}"
- traefik.http.routers.navidrome.rule: "Host(`{{ navidrome_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.navidrome.tls.certresolver: "letsencrypt"
- traefik.http.routers.navidrome.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.navidrome.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.navidrome.loadbalancer.server.port: "4533"
+ - name: Navidrome Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ navidrome_container_name }}"
+ image: "{{ navidrome_image_name }}:{{ navidrome_image_version }}"
+ pull: true
+ volumes:
+ - "{{ navidrome_data_directory }}/data:/navidrome/data:rw"
+ - "{{ navidrome_music_directory }}:/navidrome/music:rw"
+ ports:
+ - "{{ navidrome_port }}:4533"
+ env:
+ ND_MUSICFOLDER: "/navidrome/music"
+ ND_DATAFOLDER: "/navidrome/data"
+ ND_SCANSCHEDULE: "{{ navidrome_scan_schedule }}"
+ ND_LOGLEVEL: "{{ navidrome_log_level }}"
+ ND_SESSIONTIMEOUT: "{{ navidrome_session_timeout }}"
+ restart_policy: unless-stopped
+ memory: "{{ navidrome_memory }}"
+ labels:
+ traefik.enable: "{{ navidrome_available_externally | string }}"
+ traefik.http.routers.navidrome.rule: "Host(`{{ navidrome_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.navidrome.tls.certresolver: "letsencrypt"
+ traefik.http.routers.navidrome.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.navidrome.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.navidrome.loadbalancer.server.port: "4533"
+ when: navidrome_enabled is true
+
+- name: Stop Navidrome
+ block:
+ - name: Stop Navidrome
+ community.docker.docker_container:
+ name: "{{ navidrome_container_name }}"
+ state: absent
+ when: navidrome_enabled is false
diff --git a/roles/netbootxyz/defaults/main.yml b/roles/netbootxyz/defaults/main.yml
index d07a21bb..9664eacd 100644
--- a/roles/netbootxyz/defaults/main.yml
+++ b/roles/netbootxyz/defaults/main.yml
@@ -12,7 +12,10 @@ netbootxyz_port_http: "3002"
netbootxyz_port_http2: "5803"
netbootxyz_port_tftp: "69"
-# uid/gid
+# docker
+netbootxyz_container_name: "netbootxyz"
+netbootxyz_image_name: "linuxserver/netbootxyz"
+netbootxyz_image_version: "latest"
netbootxyz_user_id: "1000"
netbootxyz_group_id: "1000"
diff --git a/roles/netbootxyz/molecule/default/molecule.yml b/roles/netbootxyz/molecule/default/molecule.yml
new file mode 100644
index 00000000..c563631f
--- /dev/null
+++ b/roles/netbootxyz/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ netbootxyz_enabled: true
diff --git a/roles/netbootxyz/molecule/default/side_effect.yml b/roles/netbootxyz/molecule/default/side_effect.yml
new file mode 100644
index 00000000..aa02d185
--- /dev/null
+++ b/roles/netbootxyz/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ netbootxyz_enabled: false
diff --git a/roles/netbootxyz/molecule/default/verify.yml b/roles/netbootxyz/molecule/default/verify.yml
new file mode 100644
index 00000000..2f2efee8
--- /dev/null
+++ b/roles/netbootxyz/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get netbootxyz container state
+ community.docker.docker_container:
+ name: "{{ netbootxyz_container_name }}"
+ register: result
+
+ - name: Check if netbootxyz containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/netbootxyz/molecule/default/verify_stopped.yml b/roles/netbootxyz/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..86e12133
--- /dev/null
+++ b/roles/netbootxyz/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove netbootxyz
+ community.docker.docker_container:
+ name: "{{ netbootxyz_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if netbootxyz is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/netbootxyz/tasks/main.yml b/roles/netbootxyz/tasks/main.yml
index 4247a50c..e135ddb3 100644
--- a/roles/netbootxyz/tasks/main.yml
+++ b/roles/netbootxyz/tasks/main.yml
@@ -1,34 +1,46 @@
---
-- name: Netbootxyz Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ netbootxyz_config_directory }}"
- - "{{ netbootxyz_assets_directory }}"
+- name: Start Netbootxyz
+ block:
+ - name: Netbootxyz Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ netbootxyz_config_directory }}"
+ - "{{ netbootxyz_assets_directory }}"
-- name: Netbootxyz Docker Container
- docker_container:
- name: netbootxyz
- image: linuxserver/netbootxyz:latest
- pull: true
- volumes:
- - "{{ netbootxyz_config_directory }}:/config:rw"
- - "{{ netbootxyz_assets_directory }}:/assets:rw"
- ports:
- - "{{ netbootxyz_port_http }}:3000"
- - "{{ netbootxyz_port_http2 }}:80"
- - "{{ netbootxyz_port_tftp }}:69/udp"
- memory: "{{ netbootxyz_memory }}"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ netbootxyz_user_id }}"
- PGID: "{{ netbootxyz_group_id }}"
- restart_policy: unless-stopped
- labels:
- traefik.enable: "{{ netbootxyz_available_externally | string }}"
- traefik.http.routers.netbootxyz.rule: "Host(`{{ netbootxyz_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.netbootxyz.tls.certresolver: "letsencrypt"
- traefik.http.routers.netbootxyz.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.netbootxyz.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.netbootxyz.loadbalancer.server.port: "3000"
+ - name: Netbootxyz Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ netbootxyz_container_name }}"
+ image: "{{ netbootxyz_image_name }}:{{ netbootxyz_image_version }}"
+ pull: true
+ volumes:
+ - "{{ netbootxyz_config_directory }}:/config:rw"
+ - "{{ netbootxyz_assets_directory }}:/assets:rw"
+ ports:
+ - "{{ netbootxyz_port_http }}:3000"
+ - "{{ netbootxyz_port_http2 }}:80"
+ - "{{ netbootxyz_port_tftp }}:69/udp"
+ memory: "{{ netbootxyz_memory }}"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ netbootxyz_user_id }}"
+ PGID: "{{ netbootxyz_group_id }}"
+ restart_policy: unless-stopped
+ labels:
+ traefik.enable: "{{ netbootxyz_available_externally | string }}"
+ traefik.http.routers.netbootxyz.rule: "Host(`{{ netbootxyz_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.netbootxyz.tls.certresolver: "letsencrypt"
+ traefik.http.routers.netbootxyz.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.netbootxyz.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.netbootxyz.loadbalancer.server.port: "3000"
+ when: netbootxyz_enabled is true
+
+- name: Stop Netbootxyz
+ block:
+ - name: Stop Netbootxyz
+ community.docker.docker_container:
+ name: "{{ netbootxyz_container_name }}"
+ state: absent
+ when: netbootxyz_enabled is false
diff --git a/roles/netdata/defaults/main.yml b/roles/netdata/defaults/main.yml
index 148e8b11..80135fb2 100644
--- a/roles/netdata/defaults/main.yml
+++ b/roles/netdata/defaults/main.yml
@@ -6,5 +6,10 @@ netdata_available_externally: false
netdata_hostname: "netdata"
netdata_port: "19999"
+# docker
+netdata_container_name: "netdata"
+netdata_image_name: "netdata/netdata"
+netdata_image_version: "latest"
+
# specs
netdata_memory: 1g
diff --git a/roles/netdata/molecule/default/molecule.yml b/roles/netdata/molecule/default/molecule.yml
new file mode 100644
index 00000000..ac74c328
--- /dev/null
+++ b/roles/netdata/molecule/default/molecule.yml
@@ -0,0 +1,7 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ netdata_enabled: true
+ ansible_nas_hostname: ansible-nas
diff --git a/roles/netdata/molecule/default/side_effect.yml b/roles/netdata/molecule/default/side_effect.yml
new file mode 100644
index 00000000..49ed1fb6
--- /dev/null
+++ b/roles/netdata/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ netdata_enabled: false
diff --git a/roles/netdata/molecule/default/verify.yml b/roles/netdata/molecule/default/verify.yml
new file mode 100644
index 00000000..6094369d
--- /dev/null
+++ b/roles/netdata/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get netdata container state
+ community.docker.docker_container:
+ name: "{{ netdata_container_name }}"
+ register: result
+
+ - name: Check if netdata containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/netdata/molecule/default/verify_stopped.yml b/roles/netdata/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..7fe1d292
--- /dev/null
+++ b/roles/netdata/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove netdata
+ community.docker.docker_container:
+ name: "{{ netdata_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if netdata is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/netdata/tasks/main.yml b/roles/netdata/tasks/main.yml
index d41c3486..d1e2063f 100644
--- a/roles/netdata/tasks/main.yml
+++ b/roles/netdata/tasks/main.yml
@@ -1,34 +1,46 @@
---
-- name: Get docker group id
- group:
- name: docker
- register: docker_group
+- name: Start Netdata
+ block:
+ - name: Get docker group id
+ ansible.builtin.group:
+ name: docker
+ register: docker_group
-- name: Netdata Docker Container
- docker_container:
- name: netdata
- hostname: "{{ ansible_nas_hostname }}.{{ ansible_nas_domain }}"
- image: netdata/netdata
- state: started
- pull: true
- ports:
- - "{{ netdata_port }}:19999"
- volumes:
- - "/proc:/host/proc:ro"
- - "/sys:/host/sys:ro"
- - "/var/run/docker.sock:/var/run/docker.sock:ro"
- env:
- PGID: "{{ docker_group.gid }}"
- capabilities:
- - SYS_PTRACE
- security_opts:
- - apparmor:unconfined
- restart_policy: unless-stopped
- memory: "{{ netdata_memory }}"
- labels:
- traefik.enable: "{{ netdata_available_externally | string }}"
- traefik.http.routers.netdata.rule: "Host(`{{ netdata_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.netdata.tls.certresolver: "letsencrypt"
- traefik.http.routers.netdata.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.netdata.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.netdata.loadbalancer.server.port: "19999"
+ - name: Netdata Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ netdata_container_name }}"
+ image: "{{ netdata_image_name }}:{{ netdata_image_version }}"
+ hostname: "{{ ansible_nas_hostname }}.{{ ansible_nas_domain }}"
+ state: started
+ pull: true
+ ports:
+ - "{{ netdata_port }}:19999"
+ volumes:
+ - "/proc:/host/proc:ro"
+ - "/sys:/host/sys:ro"
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
+ env:
+ PGID: "{{ docker_group.gid }}"
+ capabilities:
+ - SYS_PTRACE
+ security_opts:
+ - apparmor:unconfined
+ restart_policy: unless-stopped
+ memory: "{{ netdata_memory }}"
+ labels:
+ traefik.enable: "{{ netdata_available_externally | string }}"
+ traefik.http.routers.netdata.rule: "Host(`{{ netdata_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.netdata.tls.certresolver: "letsencrypt"
+ traefik.http.routers.netdata.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.netdata.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.netdata.loadbalancer.server.port: "19999"
+ when: netdata_enabled is true
+
+- name: Stop Netdata
+ block:
+ - name: Stop Netdata
+ community.docker.docker_container:
+ name: "{{ netdata_container_name }}"
+ state: absent
+ when: netdata_enabled is false
diff --git a/roles/nextcloud/defaults/main.yml b/roles/nextcloud/defaults/main.yml
index adfe0cfa..802fe365 100644
--- a/roles/nextcloud/defaults/main.yml
+++ b/roles/nextcloud/defaults/main.yml
@@ -5,13 +5,18 @@ nextcloud_available_externally: false
# directories
nextcloud_data_directory: "{{ docker_home }}/nextcloud"
-# images
-nextcloud_image: "nextcloud:stable"
-nextcloud_mysql_image: "mysql:5.7"
-
# network
nextcloud_port: "8080"
nextcloud_hostname: "nextcloud"
+nextcloud_network_name: "nextcloud"
+
+# docker
+nextcloud_container_name: "nextcloud"
+nextcloud_image_name: "nextcloud"
+nextcloud_image_version: "stable"
+nextcloud_db_container_name: "nextcloud-db"
+nextcloud_db_image_name: "mysql"
+nextcloud_db_image_version: "5.7"
# username / passwords
nextcloud_sql_user: "nextcloud-user"
@@ -20,4 +25,4 @@ nextcloud_sql_root_password: "nextcloud-secret"
# specs
nextcloud_memory: 1g
-nextcloud_mysql_memory: 1g
+nextcloud_db_memory: 1g
diff --git a/roles/nextcloud/molecule/default/molecule.yml b/roles/nextcloud/molecule/default/molecule.yml
new file mode 100644
index 00000000..16ec0be5
--- /dev/null
+++ b/roles/nextcloud/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ nextcloud_enabled: true
diff --git a/roles/nextcloud/molecule/default/side_effect.yml b/roles/nextcloud/molecule/default/side_effect.yml
new file mode 100644
index 00000000..e760bb55
--- /dev/null
+++ b/roles/nextcloud/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ nextcloud_enabled: false
diff --git a/roles/nextcloud/molecule/default/verify.yml b/roles/nextcloud/molecule/default/verify.yml
new file mode 100644
index 00000000..d4213726
--- /dev/null
+++ b/roles/nextcloud/molecule/default/verify.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get nextcloud db container state
+ community.docker.docker_container:
+ name: "{{ nextcloud_db_container_name }}"
+ register: result_db
+
+ - name: Get nextcloud container state
+ community.docker.docker_container:
+ name: "{{ nextcloud_container_name }}"
+ register: result
+
+ - name: Check if nextcloud containers are running
+ ansible.builtin.assert:
+ that:
+ - result_db.container['State']['Status'] == "running"
+ - result_db.container['State']['Restarting'] == false
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/nextcloud/molecule/default/verify_stopped.yml b/roles/nextcloud/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..26edbcab
--- /dev/null
+++ b/roles/nextcloud/molecule/default/verify_stopped.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove nextcloud
+ community.docker.docker_container:
+ name: "{{ nextcloud_container_name }}"
+ state: absent
+ register: result
+
+ - name: Try and stop and remove nextcloud db
+ community.docker.docker_container:
+ name: "{{ nextcloud_db_container_name }}"
+ state: absent
+ register: result_db
+
+ - name: Check if nextcloud is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
+ - not result_db.changed
diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml
index 48f16286..5841354b 100644
--- a/roles/nextcloud/tasks/main.yml
+++ b/roles/nextcloud/tasks/main.yml
@@ -1,50 +1,75 @@
---
-- name: Create Nextcloud directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ nextcloud_data_directory }}/nextcloud"
- - "{{ nextcloud_data_directory }}/mysql"
+- name: Start Nextcloud
+ block:
+ - name: Create Nextcloud directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ nextcloud_data_directory }}/nextcloud"
+ - "{{ nextcloud_data_directory }}/mysql"
-- name: Nextcloud Mysql Docker Container
- docker_container:
- name: nextcloud-mysql
- image: "{{ nextcloud_mysql_image }}"
- pull: true
- volumes:
- - "{{ nextcloud_data_directory }}/mysql:/var/lib/mysql:rw"
- env:
- MYSQL_DATABASE: "nextcloud"
- MYSQL_USER: "{{ nextcloud_sql_user }}"
- MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
- MYSQL_ROOT_PASSWORD: "{{ nextcloud_sql_root_password }}"
- restart_policy: unless-stopped
- memory: "{{ nextcloud_mysql_memory }}"
+ - name: Create Nextcloud network
+ community.docker.docker_network:
+ name: "{{ nextcloud_network_name }}"
-- name: Nextcloud Docker Container
- docker_container:
- name: nextcloud
- image: "{{ nextcloud_image }}"
- pull: true
- links:
- - nextcloud-mysql:mysql
- volumes:
- - "{{ nextcloud_data_directory }}/nextcloud:/var/www/html:rw"
- ports:
- - "{{ nextcloud_port }}:80"
- env:
- MYSQL_HOST: "mysql"
- MYSQL_DATABASE: "nextcloud"
- MYSQL_USER: "{{ nextcloud_sql_user }}"
- MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
- NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_hostname }}.{{ ansible_nas_domain }}"
- restart_policy: unless-stopped
- memory: "{{ nextcloud_memory }}"
- labels:
- traefik.enable: "{{ nextcloud_available_externally | string }}"
- traefik.http.routers.nextcloud.rule: "Host(`{{ nextcloud_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.nextcloud.tls.certresolver: "letsencrypt"
- traefik.http.routers.nextcloud.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.nextcloud.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.nextcloud.loadbalancer.server.port: "80"
+ - name: Nextcloud Mysql Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ nextcloud_db_container_name }}"
+ image: "{{ nextcloud_db_image_name }}:{{ nextcloud_db_image_version }}"
+ networks:
+ - name: "{{ nextcloud_network_name }}"
+ network_mode: "{{ nextcloud_network_name }}"
+ pull: true
+ volumes:
+ - "{{ nextcloud_data_directory }}/mysql:/var/lib/mysql:rw"
+ env:
+ MYSQL_DATABASE: "nextcloud"
+ MYSQL_USER: "{{ nextcloud_sql_user }}"
+ MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
+ MYSQL_ROOT_PASSWORD: "{{ nextcloud_sql_root_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ nextcloud_db_memory }}"
+
+ - name: Nextcloud Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ nextcloud_container_name }}"
+ image: "{{ nextcloud_image_name }}:{{ nextcloud_image_version }}"
+ networks:
+ - name: "{{ nextcloud_network_name }}"
+ network_mode: "{{ nextcloud_network_name }}"
+ pull: true
+ volumes:
+ - "{{ nextcloud_data_directory }}/nextcloud:/var/www/html:rw"
+ ports:
+ - "{{ nextcloud_port }}:80"
+ env:
+ MYSQL_HOST: "{{ nextcloud_db_container_name }}"
+ MYSQL_DATABASE: "nextcloud"
+ MYSQL_USER: "{{ nextcloud_sql_user }}"
+ MYSQL_PASSWORD: "{{ nextcloud_sql_password }}"
+ NEXTCLOUD_TRUSTED_DOMAINS: "{{ nextcloud_hostname }}.{{ ansible_nas_domain }}"
+ restart_policy: unless-stopped
+ memory: "{{ nextcloud_memory }}"
+ labels:
+ traefik.enable: "{{ nextcloud_available_externally | string }}"
+ traefik.http.routers.nextcloud.rule: "Host(`{{ nextcloud_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.nextcloud.tls.certresolver: "letsencrypt"
+ traefik.http.routers.nextcloud.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.nextcloud.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.nextcloud.loadbalancer.server.port: "80"
+ when: nextcloud_enabled is true
+
+- name: Stop Nextcloud
+ block:
+ - name: Stop Nextcloud
+ community.docker.docker_container:
+ name: "{{ nextcloud_container_name }}"
+ state: absent
+ - name: Stop Nextcloud DB
+ community.docker.docker_container:
+ name: "{{ nextcloud_db_container_name }}"
+ state: absent
+ when: nextcloud_enabled is false
diff --git a/roles/nomad/molecule/default/molecule.yml b/roles/nomad/molecule/default/molecule.yml
new file mode 100644
index 00000000..232bcfee
--- /dev/null
+++ b/roles/nomad/molecule/default/molecule.yml
@@ -0,0 +1,16 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ nomad_enabled: true
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ cgroupns_mode: host
+ command: "/usr/sbin/init"
+ privileged: true
+ pre_build_image: true
diff --git a/roles/nomad/molecule/default/side_effect.yml b/roles/nomad/molecule/default/side_effect.yml
new file mode 100644
index 00000000..c9375ee0
--- /dev/null
+++ b/roles/nomad/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ nomad_enabled: false
diff --git a/roles/nomad/molecule/default/verify.yml b/roles/nomad/molecule/default/verify.yml
new file mode 100644
index 00000000..2efc7cd6
--- /dev/null
+++ b/roles/nomad/molecule/default/verify.yml
@@ -0,0 +1,21 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get Nomad service state
+ ansible.builtin.systemd:
+ name: "{{ nomad_service_name }}"
+ state: started
+ register: service_result
+
+ - name: Check that Nomad service is running
+ ansible.builtin.assert:
+ that:
+ - service_result.status['ActiveState'] == "active"
+ - service_result.status['Result'] == "success"
+ - service_result.state == "started"
diff --git a/roles/nomad/molecule/default/verify_stopped.yml b/roles/nomad/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..e51d9c9f
--- /dev/null
+++ b/roles/nomad/molecule/default/verify_stopped.yml
@@ -0,0 +1,18 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Nomad - retrieve information
+ ansible.builtin.stat:
+ path: /usr/bin/nomad
+ register: nomad_file
+
+ - name: Nomad - assert that file is removed
+ ansible.builtin.assert:
+ that: not nomad_file.stat.exists
+ fail_msg: "The file /usr/bin/nomad still exists!"
diff --git a/roles/nomad/tasks/main.yml b/roles/nomad/tasks/main.yml
index f11a764e..2b19bf72 100644
--- a/roles/nomad/tasks/main.yml
+++ b/roles/nomad/tasks/main.yml
@@ -2,9 +2,11 @@
- name: Install and start Nomad
block:
- name: Add Hashicorp GPG key
- ansible.builtin.apt_key:
+ ansible.builtin.get_url:
url: https://apt.releases.hashicorp.com/gpg
- state: present
+ dest: /etc/apt/trusted.gpg.d/hashicorp.asc
+ mode: '0644'
+ force: true
- name: Add Hashicorp apt repository
ansible.builtin.apt_repository:
diff --git a/roles/nzbget/defaults/main.yml b/roles/nzbget/defaults/main.yml
index d18e7ddf..6fb474d2 100644
--- a/roles/nzbget/defaults/main.yml
+++ b/roles/nzbget/defaults/main.yml
@@ -14,5 +14,10 @@ nzbget_group_id: "0"
nzbget_port: "6789"
nzbget_hostname: "nzbget"
+# docker
+nzbget_container_name: "nzbget"
+nzbget_image_name: "linuxserver/nzbget"
+nzbget_image_version: "latest"
+
# specs
nzbget_memory: "1g"
diff --git a/roles/nzbget/molecule/default/molecule.yml b/roles/nzbget/molecule/default/molecule.yml
new file mode 100644
index 00000000..b05e1d50
--- /dev/null
+++ b/roles/nzbget/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ nzbget_enabled: true
diff --git a/roles/nzbget/molecule/default/side_effect.yml b/roles/nzbget/molecule/default/side_effect.yml
new file mode 100644
index 00000000..32a100e2
--- /dev/null
+++ b/roles/nzbget/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ nzbget_enabled: false
diff --git a/roles/nzbget/molecule/default/verify.yml b/roles/nzbget/molecule/default/verify.yml
new file mode 100644
index 00000000..b9d7422e
--- /dev/null
+++ b/roles/nzbget/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get nzbget container state
+ community.docker.docker_container:
+ name: "{{ nzbget_container_name }}"
+ register: result
+
+ - name: Check if nzbget containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/nzbget/molecule/default/verify_stopped.yml b/roles/nzbget/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..1c228aec
--- /dev/null
+++ b/roles/nzbget/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove nzbget
+ community.docker.docker_container:
+ name: "{{ nzbget_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if nzbget is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/nzbget/tasks/main.yml b/roles/nzbget/tasks/main.yml
index d951041d..767ea625 100644
--- a/roles/nzbget/tasks/main.yml
+++ b/roles/nzbget/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create NZBget Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ nzbget_data_directory }}"
+- name: Start NZBget
+ block:
+ - name: Create NZBget Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ nzbget_data_directory }}"
-- name: NZBGet
- docker_container:
- name: nzbget
- image: linuxserver/nzbget
- pull: true
- volumes:
- - "{{ nzbget_download_directory }}:/downloads:rw"
- - "{{ nzbget_data_directory }}:/config:rw"
- ports:
- - "{{ nzbget_port }}:6789"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ nzbget_user_id }}"
- PGID: "{{ nzbget_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ nzbget_memory }}"
- labels:
- traefik.enable: "{{ nzbget_available_externally | string }}"
- traefik.http.routers.nzbget.rule: "Host(`{{ nzbget_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.nzbget.tls.certresolver: "letsencrypt"
- traefik.http.routers.nzbget.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.nzbget.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.nzbget.loadbalancer.server.port: "6789"
+ - name: NZBGet
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ nzbget_container_name }}"
+ image: "{{ nzbget_image_name }}:{{ nzbget_image_version }}"
+ pull: true
+ volumes:
+ - "{{ nzbget_download_directory }}:/downloads:rw"
+ - "{{ nzbget_data_directory }}:/config:rw"
+ ports:
+ - "{{ nzbget_port }}:6789"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ nzbget_user_id }}"
+ PGID: "{{ nzbget_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ nzbget_memory }}"
+ labels:
+ traefik.enable: "{{ nzbget_available_externally | string }}"
+ traefik.http.routers.nzbget.rule: "Host(`{{ nzbget_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.nzbget.tls.certresolver: "letsencrypt"
+ traefik.http.routers.nzbget.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.nzbget.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.nzbget.loadbalancer.server.port: "6789"
+ when: nzbget_enabled is true
+
+- name: Stop NZBget
+ block:
+ - name: Stop NZBget
+ community.docker.docker_container:
+ name: "{{ nzbget_container_name }}"
+ state: absent
+ when: nzbget_enabled is false
diff --git a/roles/octoprint/defaults/main.yml b/roles/octoprint/defaults/main.yml
index 91bf467f..7bb80e4d 100644
--- a/roles/octoprint/defaults/main.yml
+++ b/roles/octoprint/defaults/main.yml
@@ -9,6 +9,11 @@ octoprint_data_directory: "{{ docker_home }}/octoprint"
octoprint_port: "8095"
octoprint_hostname: "octoprint"
+# docker
+octoprint_container_name: "octoprint"
+octoprint_image_name: "octoprint/octoprint"
+octoprint_image_version: "latest"
+
# devices
octoprint_printer_mountpoint: "/dev/ttyUSB0"
diff --git a/roles/octoprint/molecule/default/molecule.yml b/roles/octoprint/molecule/default/molecule.yml
new file mode 100644
index 00000000..3589c73f
--- /dev/null
+++ b/roles/octoprint/molecule/default/molecule.yml
@@ -0,0 +1,18 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ octoprint_enabled: true
+ octoprint_printer_mountpoint: "/dev/null"
+ octoprint_webcam_mountpoint: "/dev/null"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /dev/null:/dev/null
+ cgroupns_mode: host
+ privileged: true
+ pre_build_image: true
diff --git a/roles/octoprint/molecule/default/side_effect.yml b/roles/octoprint/molecule/default/side_effect.yml
new file mode 100644
index 00000000..c9f53c2e
--- /dev/null
+++ b/roles/octoprint/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ octoprint_enabled: false
diff --git a/roles/octoprint/molecule/default/verify.yml b/roles/octoprint/molecule/default/verify.yml
new file mode 100644
index 00000000..e7b628f8
--- /dev/null
+++ b/roles/octoprint/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get octoprint container state
+ community.docker.docker_container:
+ name: "{{ octoprint_container_name }}"
+ register: result
+
+ - name: Check if octoprint containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/octoprint/molecule/default/verify_stopped.yml b/roles/octoprint/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..23dca6fc
--- /dev/null
+++ b/roles/octoprint/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove octoprint
+ community.docker.docker_container:
+ name: "{{ octoprint_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if octoprint is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/octoprint/tasks/main.yml b/roles/octoprint/tasks/main.yml
index 40d84fce..77cf2b16 100644
--- a/roles/octoprint/tasks/main.yml
+++ b/roles/octoprint/tasks/main.yml
@@ -1,33 +1,45 @@
---
-- name: Create Octoprint Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ octoprint_data_directory }}"
+- name: Start Octoprint
+ block:
+ - name: Create Octoprint Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ octoprint_data_directory }}"
-- name: Octoprint Docker Container
- docker_container:
- name: octoprint
- image: octoprint/octoprint
- pull: true
- volumes:
- - "{{ octoprint_data_directory }}:/octoprint:rw"
- ports:
- - "{{ octoprint_port }}:80"
- devices:
- - "{{ octoprint_printer_mountpoint }}"
- - "{{ octoprint_enable_webcam | ternary(octoprint_webcam_mountpoint, '/dev/null') }}"
- restart_policy: unless-stopped
- memory: "{{ octoprint_memory }}"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- MJPG_STREAMER_INPUT: "-n -r 1080x1024 -f 30"
- ENABLE_MJPG_STREAMER: "{{ octoprint_enable_webcam | string }}"
- labels:
- traefik.enable: "{{ octoprint_available_externally | string }}"
- traefik.http.routers.octoprint.rule: "Host(`{{ octoprint_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.octoprint.tls.certresolver: "letsencrypt"
- traefik.http.routers.octoprint.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.octoprint.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.octoprint.loadbalancer.server.port: "80"
+ - name: Octoprint Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ octoprint_container_name }}"
+ image: "{{ octoprint_image_name }}:{{ octoprint_image_version }}"
+ pull: true
+ volumes:
+ - "{{ octoprint_data_directory }}:/octoprint:rw"
+ ports:
+ - "{{ octoprint_port }}:80"
+ devices:
+ - "{{ octoprint_printer_mountpoint }}"
+ - "{{ octoprint_enable_webcam | ternary(octoprint_webcam_mountpoint, '/dev/null') }}"
+ restart_policy: unless-stopped
+ memory: "{{ octoprint_memory }}"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ MJPG_STREAMER_INPUT: "-n -r 1080x1024 -f 30"
+ ENABLE_MJPG_STREAMER: "{{ octoprint_enable_webcam | string }}"
+ labels:
+ traefik.enable: "{{ octoprint_available_externally | string }}"
+ traefik.http.routers.octoprint.rule: "Host(`{{ octoprint_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.octoprint.tls.certresolver: "letsencrypt"
+ traefik.http.routers.octoprint.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.octoprint.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.octoprint.loadbalancer.server.port: "80"
+ when: octoprint_enabled is true
+
+- name: Stop Octoprint
+ block:
+ - name: Stop Octoprint
+ community.docker.docker_container:
+ name: "{{ octoprint_container_name }}"
+ state: absent
+ when: octoprint_enabled is false
diff --git a/roles/ombi/defaults/main.yml b/roles/ombi/defaults/main.yml
index 7de3e157..c29a1cbe 100644
--- a/roles/ombi/defaults/main.yml
+++ b/roles/ombi/defaults/main.yml
@@ -9,7 +9,10 @@ ombi_config_directory: "{{ docker_home }}/ombi/config"
ombi_port: "3579"
ombi_hostname: "ombi"
-# uid / gid
+# docker
+ombi_container_name: "ombi"
+ombi_image_name: "linuxserver/ombi"
+ombi_image_version: "latest"
ombi_user_id: "0"
ombi_group_id: "0"
diff --git a/roles/ombi/molecule/default/molecule.yml b/roles/ombi/molecule/default/molecule.yml
new file mode 100644
index 00000000..01f8b451
--- /dev/null
+++ b/roles/ombi/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ ombi_enabled: true
diff --git a/roles/ombi/molecule/default/side_effect.yml b/roles/ombi/molecule/default/side_effect.yml
new file mode 100644
index 00000000..aa51bb8d
--- /dev/null
+++ b/roles/ombi/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ ombi_enabled: false
diff --git a/roles/ombi/molecule/default/verify.yml b/roles/ombi/molecule/default/verify.yml
new file mode 100644
index 00000000..91f442a8
--- /dev/null
+++ b/roles/ombi/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get ombi container state
+ community.docker.docker_container:
+ name: "{{ ombi_container_name }}"
+ register: result
+
+ - name: Check if ombi containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/ombi/molecule/default/verify_stopped.yml b/roles/ombi/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..2ee8ef53
--- /dev/null
+++ b/roles/ombi/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove ombi
+ community.docker.docker_container:
+ name: "{{ ombi_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if ombi is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/ombi/tasks/main.yml b/roles/ombi/tasks/main.yml
index 226a368e..140d2e42 100644
--- a/roles/ombi/tasks/main.yml
+++ b/roles/ombi/tasks/main.yml
@@ -1,28 +1,40 @@
---
-- name: Create Ombi Directories
- file:
- path: "{{ ombi_config_directory }}"
- state: directory
+- name: Start Ombi
+ block:
+ - name: Create Ombi Directories
+ ansible.builtin.file:
+ path: "{{ ombi_config_directory }}"
+ state: directory
-- name: Ombi Docker Container
- docker_container:
- name: ombi
- image: linuxserver/ombi
- pull: true
- volumes:
- - "{{ ombi_config_directory }}:/config:rw"
- ports:
- - "{{ ombi_port }}:3579"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ ombi_user_id }}"
- PGID: "{{ ombi_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ ombi_memory }}"
- labels:
- traefik.enable: "{{ ombi_available_externally | string }}"
- traefik.http.routers.ombi.rule: "Host(`{{ ombi_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.ombi.tls.certresolver: "letsencrypt"
- traefik.http.routers.ombi.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.ombi.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.ombi.loadbalancer.server.port: "3579"
+ - name: Ombi Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ ombi_container_name }}"
+ image: "{{ ombi_image_name }}:{{ ombi_image_version }}"
+ pull: true
+ volumes:
+ - "{{ ombi_config_directory }}:/config:rw"
+ ports:
+ - "{{ ombi_port }}:3579"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ ombi_user_id }}"
+ PGID: "{{ ombi_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ ombi_memory }}"
+ labels:
+ traefik.enable: "{{ ombi_available_externally | string }}"
+ traefik.http.routers.ombi.rule: "Host(`{{ ombi_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.ombi.tls.certresolver: "letsencrypt"
+ traefik.http.routers.ombi.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.ombi.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.ombi.loadbalancer.server.port: "3579"
+ when: ombi_enabled is true
+
+- name: Stop Ombi
+ block:
+ - name: Stop Ombi
+ community.docker.docker_container:
+ name: "{{ ombi_container_name }}"
+ state: absent
+ when: ombi_enabled is false
diff --git a/roles/openhab/defaults/main.yml b/roles/openhab/defaults/main.yml
index 0e62c638..97193ed6 100644
--- a/roles/openhab/defaults/main.yml
+++ b/roles/openhab/defaults/main.yml
@@ -10,5 +10,10 @@ openhab_port_http: "7777"
openhab_port_https: "7778"
openhab_hostname: "openhab"
+# docker
+openhab_container_name: "openhab"
+openhab_image_name: "openhab/openhab"
+openhab_image_version: "latest"
+
# specs
openhab_memory: 1g
diff --git a/roles/openhab/molecule/default/molecule.yml b/roles/openhab/molecule/default/molecule.yml
new file mode 100644
index 00000000..eba46adf
--- /dev/null
+++ b/roles/openhab/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ openhab_enabled: true
diff --git a/roles/openhab/molecule/default/side_effect.yml b/roles/openhab/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f8d54f8b
--- /dev/null
+++ b/roles/openhab/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ openhab_enabled: false
diff --git a/roles/openhab/molecule/default/verify.yml b/roles/openhab/molecule/default/verify.yml
new file mode 100644
index 00000000..78a33001
--- /dev/null
+++ b/roles/openhab/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get openhab container state
+ community.docker.docker_container:
+ name: "{{ openhab_container_name }}"
+ register: result
+
+ - name: Check if openhab containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/openhab/molecule/default/verify_stopped.yml b/roles/openhab/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..d7aeec10
--- /dev/null
+++ b/roles/openhab/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove openhab
+ community.docker.docker_container:
+ name: "{{ openhab_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if openhab is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/openhab/tasks/main.yml b/roles/openhab/tasks/main.yml
index 2b463247..ecfe75e4 100644
--- a/roles/openhab/tasks/main.yml
+++ b/roles/openhab/tasks/main.yml
@@ -1,53 +1,65 @@
---
-- name: Create openHAB group
- group:
- name: openhab
- gid: 9001
- state: present
+- name: Start openHAB
+ block:
+ - name: Create openHAB group
+ ansible.builtin.group:
+ name: openhab
+ gid: 9001
+ state: present
-- name: Create openHAB user
- user:
- name: openhab
- uid: 9001
- state: present
- system: yes
- update_password: on_create
- create_home: no
- group: openhab
+ - name: Create openHAB user
+ ansible.builtin.user:
+ name: openhab
+ uid: 9001
+ state: present
+ system: yes
+ update_password: on_create
+ create_home: no
+ group: openhab
-- name: Create openHAB Directories
- file:
- path: "{{ item }}"
- state: directory
- owner: openhab
- group: openhab
- with_items:
- - "{{ openhab_data_directory }}"
- - "{{ openhab_data_directory }}/conf"
- - "{{ openhab_data_directory }}/userdata"
- - "{{ openhab_data_directory }}/addons"
+ - name: Create openHAB Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ owner: openhab
+ group: openhab
+ with_items:
+ - "{{ openhab_data_directory }}"
+ - "{{ openhab_data_directory }}/conf"
+ - "{{ openhab_data_directory }}/userdata"
+ - "{{ openhab_data_directory }}/addons"
-- name: Create openHAB container
- docker_container:
- name: openHAB
- image: openhab/openhab
- pull: true
- network_mode: "host"
- volumes:
- - "{{ openhab_data_directory }}/conf:/openhab/conf:rw"
- - "{{ openhab_data_directory }}/userdata:/openhab/userdata:rw"
- - "{{ openhab_data_directory }}/addons:/openhab/addons:rw"
- - "/etc/localtime:/etc/localtime:ro"
- - "/etc/timezone:/etc/timezone:ro"
- env:
- OPENHAB_HTTP_PORT: "{{ openhab_port_http }}"
- OPENHAB_HTTPS_PORT: "{{ openhab_port_https }}"
- restart_policy: unless-stopped
- memory: "{{ openhab_memory }}"
- labels:
- traefik.enable: "{{ openhab_available_externally | string }}"
- traefik.http.routers.openhab.rule: "Host(`{{ openhab_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.openhab.tls.certresolver: "letsencrypt"
- traefik.http.routers.openhab.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.openhab.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.openhab.loadbalancer.server.port: "7777"
+ - name: Create openHAB container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ openhab_container_name }}"
+ image: "{{ openhab_image_name }}:{{ openhab_image_version }}"
+ pull: true
+ network_mode: "host"
+ volumes:
+ - "{{ openhab_data_directory }}/conf:/openhab/conf:rw"
+ - "{{ openhab_data_directory }}/userdata:/openhab/userdata:rw"
+ - "{{ openhab_data_directory }}/addons:/openhab/addons:rw"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "/etc/timezone:/etc/timezone:ro"
+ env:
+ OPENHAB_HTTP_PORT: "{{ openhab_port_http }}"
+ OPENHAB_HTTPS_PORT: "{{ openhab_port_https }}"
+ restart_policy: unless-stopped
+ memory: "{{ openhab_memory }}"
+ labels:
+ traefik.enable: "{{ openhab_available_externally | string }}"
+ traefik.http.routers.openhab.rule: "Host(`{{ openhab_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.openhab.tls.certresolver: "letsencrypt"
+ traefik.http.routers.openhab.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.openhab.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.openhab.loadbalancer.server.port: "7777"
+ when: openhab_enabled is true
+
+- name: Stop openHAB
+ block:
+ - name: Stop openHAB
+ community.docker.docker_container:
+ name: "{{ openhab_container_name }}"
+ state: absent
+ when: openhab_enabled is false
diff --git a/roles/organizr/defaults/main.yml b/roles/organizr/defaults/main.yml
index 9e0f7a9b..27ed930f 100644
--- a/roles/organizr/defaults/main.yml
+++ b/roles/organizr/defaults/main.yml
@@ -10,7 +10,10 @@ organizr_port_http: "10081"
organizr_port_https: "10444"
organizr_hostname: "organizr"
-# uid / gid
+# docker
+organizr_container_name: "organizr"
+organizr_image_name: "organizr/organizr"
+organizr_image_version: "latest"
organizr_user_id: "1000"
organizr_group_id: "1000"
diff --git a/roles/organizr/molecule/default/molecule.yml b/roles/organizr/molecule/default/molecule.yml
new file mode 100644
index 00000000..b9bf48dc
--- /dev/null
+++ b/roles/organizr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ organizr_enabled: true
diff --git a/roles/organizr/molecule/default/side_effect.yml b/roles/organizr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..06e293f3
--- /dev/null
+++ b/roles/organizr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ organizr_enabled: false
diff --git a/roles/organizr/molecule/default/verify.yml b/roles/organizr/molecule/default/verify.yml
new file mode 100644
index 00000000..7777f614
--- /dev/null
+++ b/roles/organizr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get organizr container state
+ community.docker.docker_container:
+ name: "{{ organizr_container_name }}"
+ register: result
+
+ - name: Check if organizr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/organizr/molecule/default/verify_stopped.yml b/roles/organizr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..3001c7c5
--- /dev/null
+++ b/roles/organizr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove organizr
+ community.docker.docker_container:
+ name: "{{ organizr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if organizr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/organizr/tasks/main.yml b/roles/organizr/tasks/main.yml
index a6e197b3..9c1d97c5 100644
--- a/roles/organizr/tasks/main.yml
+++ b/roles/organizr/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create Organizr Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ organizr_data_directory }}"
+- name: Start Organizr
+ block:
+ - name: Create Organizr Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ organizr_data_directory }}"
-- name: Create Organizr container
- docker_container:
- name: organizr
- image: organizr/organizr:latest
- pull: true
- volumes:
- - "{{ organizr_data_directory }}:/config:rw"
- env:
- PUID: "{{ organizr_user_id }}"
- PGID: "{{ organizr_group_id }}"
- TZ: "{{ ansible_nas_timezone }}"
- ports:
- - "{{ organizr_port_http }}:80"
- - "{{ organizr_port_https }}:443"
- restart_policy: unless-stopped
- memory: "{{ organizr_memory }}"
- labels:
- traefik.enable: "{{ organizr_available_externally | string }}"
- traefik.http.routers.organizr.rule: "Host(`{{ organizr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.organizr.tls.certresolver: "letsencrypt"
- traefik.http.routers.organizr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.organizr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.organizr.loadbalancer.server.port: "80"
+ - name: Create Organizr container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ organizr_container_name }}"
+ image: "{{ organizr_image_name }}:{{ organizr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ organizr_data_directory }}:/config:rw"
+ env:
+ PUID: "{{ organizr_user_id }}"
+ PGID: "{{ organizr_group_id }}"
+ TZ: "{{ ansible_nas_timezone }}"
+ ports:
+ - "{{ organizr_port_http }}:80"
+ - "{{ organizr_port_https }}:443"
+ restart_policy: unless-stopped
+ memory: "{{ organizr_memory }}"
+ labels:
+ traefik.enable: "{{ organizr_available_externally | string }}"
+ traefik.http.routers.organizr.rule: "Host(`{{ organizr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.organizr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.organizr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.organizr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.organizr.loadbalancer.server.port: "80"
+ when: organizr_enabled is true
+
+- name: Stop Organizr
+ block:
+ - name: Stop Organizr
+ community.docker.docker_container:
+ name: "{{ organizr_container_name }}"
+ state: absent
+ when: organizr_enabled is false
diff --git a/roles/overseerr/defaults/main.yml b/roles/overseerr/defaults/main.yml
index e5b14a41..6a051e09 100644
--- a/roles/overseerr/defaults/main.yml
+++ b/roles/overseerr/defaults/main.yml
@@ -5,7 +5,10 @@ overseerr_available_externally: false
# directories
overseerr_data_directory: "{{ docker_home }}/overseerr"
-# uid / gid
+# docker
+overseerr_container_name: "overseerr"
+overseerr_image_name: "sctx/overseerr"
+overseerr_image_version: "latest"
overseerr_user_id: "1000"
overseerr_group_id: "1000"
diff --git a/roles/overseerr/molecule/default/molecule.yml b/roles/overseerr/molecule/default/molecule.yml
new file mode 100644
index 00000000..c63d2109
--- /dev/null
+++ b/roles/overseerr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ overseerr_enabled: true
diff --git a/roles/overseerr/molecule/default/side_effect.yml b/roles/overseerr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..ced8fa26
--- /dev/null
+++ b/roles/overseerr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ overseerr_enabled: false
diff --git a/roles/overseerr/molecule/default/verify.yml b/roles/overseerr/molecule/default/verify.yml
new file mode 100644
index 00000000..26215c95
--- /dev/null
+++ b/roles/overseerr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get overseerr container state
+ community.docker.docker_container:
+ name: "{{ overseerr_container_name }}"
+ register: result
+
+ - name: Check if overseerr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/overseerr/molecule/default/verify_stopped.yml b/roles/overseerr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..63b0dabc
--- /dev/null
+++ b/roles/overseerr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove overseerr
+ community.docker.docker_container:
+ name: "{{ overseerr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if overseerr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/overseerr/tasks/main.yml b/roles/overseerr/tasks/main.yml
index 1f513875..9af6f942 100644
--- a/roles/overseerr/tasks/main.yml
+++ b/roles/overseerr/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create overseerr Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ overseerr_data_directory }}"
- - "{{ overseerr_data_directory }}/config"
+- name: Start Overseerr
+ block:
+ - name: Create Overseerr Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ overseerr_data_directory }}"
+ - "{{ overseerr_data_directory }}/config"
-- name: Overseerr
- docker_container:
- name: overseerr
- image: sctx/overseerr:latest
- pull: true
- volumes:
- - "{{ overseerr_data_directory }}/config:/app/config:rw"
- ports:
- - "{{ overseerr_webui_port }}:5055"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ overseerr_user_id }}"
- PGID: "{{ overseerr_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ overseerr_memory }}"
- labels:
- traefik.enable: "{{ overseerr_available_externally | string }}"
- traefik.http.routers.overseerr.rule: "Host(`{{ overseerr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.overseerr.tls.certresolver: "letsencrypt"
- traefik.http.routers.overseerr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.overseerr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.overseerr.loadbalancer.server.port: "5055"
+ - name: Overseerr
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ overseerr_container_name }}"
+ image: "{{ overseerr_image_name }}:{{ overseerr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ overseerr_data_directory }}/config:/app/config:rw"
+ ports:
+ - "{{ overseerr_webui_port }}:5055"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ overseerr_user_id }}"
+ PGID: "{{ overseerr_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ overseerr_memory }}"
+ labels:
+ traefik.enable: "{{ overseerr_available_externally | string }}"
+ traefik.http.routers.overseerr.rule: "Host(`{{ overseerr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.overseerr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.overseerr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.overseerr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.overseerr.loadbalancer.server.port: "5055"
+ when: overseerr_enabled is true
+
+- name: Stop Overseerr
+ block:
+ - name: Stop Overseerr
+ community.docker.docker_container:
+ name: "{{ overseerr_container_name }}"
+ state: absent
+ when: overseerr_enabled is false
diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml
index fb2a8be6..d7ff6d36 100644
--- a/roles/paperless_ng/defaults/main.yml
+++ b/roles/paperless_ng/defaults/main.yml
@@ -1,5 +1,6 @@
---
paperless_ng_enabled: false
+paperless_ng_available_externally: false
# directories
paperless_ng_config_directory: "{{ docker_home }}/paperless_ng"
@@ -14,6 +15,7 @@ paperless_ng_consume_directory: "{{ paperless_ng_files_directory }}/consume"
# network
paperless_ng_port: "16922"
paperless_ng_hostname: "paperless_ng"
+paperless_ng_network_name: "paperless_ng"
# postgres
paperless_ng_postgres_db: "paperless"
@@ -21,10 +23,18 @@ paperless_ng_postgres_user: "paperless"
paperless_ng_postgres_password: "paperless"
# container names
-paperless_ng_container_network_name: "paperless_ng_network"
-paperless_ng_container_name_redis: "paperless_ng_redis"
-paperless_ng_container_name_postgres: "paperless_ng_postgres"
-paperless_ng_container_name_uiserver: "paperless_ng_uiserver"
+
+paperless_ng_redis_container_name: "paperless-redis"
+paperless_ng_redis_image_name: "redis"
+paperless_ng_redis_image_version: "6.0"
+
+paperless_ng_db_container_name: "paperless-db"
+paperless_ng_db_image_name: "postgres"
+paperless_ng_db_image_version: "13"
+
+paperless_ng_uiserver_container_name: "paperless-uiserver"
+paperless_ng_uiserver_image_name: "jonaswinkler/paperless-ng"
+paperless_ng_uiserver_image_version: "latest"
# uid/guid
paperless_ng_user_id: "1000"
diff --git a/roles/paperless_ng/molecule/default/molecule.yml b/roles/paperless_ng/molecule/default/molecule.yml
new file mode 100644
index 00000000..e009fab6
--- /dev/null
+++ b/roles/paperless_ng/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ paperless_ng_enabled: true
diff --git a/roles/paperless_ng/molecule/default/side_effect.yml b/roles/paperless_ng/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5a9810b7
--- /dev/null
+++ b/roles/paperless_ng/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ paperless_ng_enabled: false
diff --git a/roles/paperless_ng/molecule/default/verify.yml b/roles/paperless_ng/molecule/default/verify.yml
new file mode 100644
index 00000000..500fae12
--- /dev/null
+++ b/roles/paperless_ng/molecule/default/verify.yml
@@ -0,0 +1,33 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get paperless_ng redis container state
+ community.docker.docker_container:
+ name: "{{ paperless_ng_redis_container_name }}"
+ register: result_redis
+
+ - name: Get paperless_ng db container state
+ community.docker.docker_container:
+ name: "{{ paperless_ng_db_container_name }}"
+ register: result_db
+
+ - name: Get paperless_ng container state
+ community.docker.docker_container:
+ name: "{{ paperless_ng_uiserver_container_name }}"
+ register: result
+
+ - name: Check if paperless_ng containers are running
+ ansible.builtin.assert:
+ that:
+ - result_redis.container['State']['Status'] == "running"
+ - result_redis.container['State']['Restarting'] == false
+ - result_db.container['State']['Status'] == "running"
+ - result_db.container['State']['Restarting'] == false
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/paperless_ng/molecule/default/verify_stopped.yml b/roles/paperless_ng/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..24f87932
--- /dev/null
+++ b/roles/paperless_ng/molecule/default/verify_stopped.yml
@@ -0,0 +1,33 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove paperless_ng
+ community.docker.docker_container:
+ name: "{{ paperless_ng_uiserver_container_name }}"
+ state: absent
+ register: result
+
+ - name: Try and stop and remove paperless_ng db
+ community.docker.docker_container:
+ name: "{{ paperless_ng_db_container_name }}"
+ state: absent
+ register: result_db
+
+ - name: Try and stop and remove paperless_ng redis
+ community.docker.docker_container:
+ name: "{{ paperless_ng_redis_container_name }}"
+ state: absent
+ register: result_redis
+
+ - name: Check if paperless_ng is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
+ - not result_db.changed
+ - not result_redis.changed
diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml
index fe3cedb6..bca48846 100644
--- a/roles/paperless_ng/tasks/main.yml
+++ b/roles/paperless_ng/tasks/main.yml
@@ -1,67 +1,96 @@
---
-- name: Create paperless_ng directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ paperless_ng_config_directory }}"
- - "{{ paperless_ng_files_directory }}"
- - "{{ paperless_ng_postgres_directory }}"
- - "{{ paperless_ng_data_directory }}"
- - "{{ paperless_ng_export_directory }}"
- - "{{ paperless_ng_media_directory }}"
- - "{{ paperless_ng_consume_directory }}"
+- name: Start paperless_ng
+ block:
+ - name: Create paperless_ng directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ paperless_ng_config_directory }}"
+ - "{{ paperless_ng_files_directory }}"
+ - "{{ paperless_ng_postgres_directory }}"
+ - "{{ paperless_ng_data_directory }}"
+ - "{{ paperless_ng_export_directory }}"
+ - "{{ paperless_ng_media_directory }}"
+ - "{{ paperless_ng_consume_directory }}"
+ - name: Create paperless_ng network
+ community.docker.docker_network:
+ name: "{{ paperless_ng_network_name }}"
-- name: Create paperless_ng network
- docker_network:
- name: "{{ paperless_ng_container_network_name }}"
+ - name: Create paperless_ng redis broker
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ paperless_ng_redis_container_name }}"
+ image: "{{ paperless_ng_redis_image_name }}:{{ paperless_ng_redis_image_version }}"
+ pull: true
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ng_redis_memory }}"
+ networks:
+ - name: "{{ paperless_ng_network_name }}"
+ network_mode: "{{ paperless_ng_network_name }}"
-- name: Create paperless_ng redis broker
- docker_container:
- name: "{{ paperless_ng_container_name_redis }}"
- image: redis:6.0
- pull: true
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_redis_memory }}"
- networks:
- - name: "{{ paperless_ng_container_network_name }}"
+ - name: Create paperless_ng postgres Docker Container
+ community.docker.docker_container:
+ name: "{{ paperless_ng_db_container_name }}"
+ image: "{{ paperless_ng_db_image_name }}:{{ paperless_ng_db_image_version }}"
+ pull: true
+ volumes:
+ - "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data"
+ env:
+ POSTGRES_DB: "{{ paperless_ng_postgres_db }}"
+ POSTGRES_USER: "{{ paperless_ng_postgres_user }}"
+ POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ng_postgres_memory }}"
+ networks:
+ - name: "{{ paperless_ng_network_name }}"
+ network_mode: "{{ paperless_ng_network_name }}"
-- name: Create paperless_ng postgres Docker Container
- docker_container:
- name: "{{ paperless_ng_container_name_postgres }}"
- image: postgres:13
- pull: true
- volumes:
- - "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data"
- env:
- POSTGRES_DB: "{{ paperless_ng_postgres_db }}"
- POSTGRES_USER: "{{ paperless_ng_postgres_user }}"
- POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}"
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_postgres_memory }}"
- networks:
- - name: "{{ paperless_ng_container_network_name }}"
+ - name: Create paperless_ng UI Docker Container
+ community.docker.docker_container:
+ name: "{{ paperless_ng_uiserver_container_name }}"
+ image: "{{ paperless_ng_uiserver_image_name }}:{{ paperless_ng_uiserver_image_version }}"
+ pull: true
+ volumes:
+ - "{{ paperless_ng_data_directory }}:/usr/src/paperless/data"
+ - "{{ paperless_ng_media_directory }}:/usr/src/paperless/media"
+ - "{{ paperless_ng_export_directory }}:/usr/src/paperless/export"
+ - "{{ paperless_ng_consume_directory }}:/usr/src/paperless/consume"
+ ports:
+ - "{{ paperless_ng_port }}:8000"
+ env:
+ PAPERLESS_REDIS: "redis://{{ paperless_ng_redis_container_name | string }}:6379"
+ PAPERLESS_DBHOST: "{{ paperless_ng_db_container_name | string }}"
+ USERMAP_UID: "{{ paperless_ng_user_id }}"
+ USERMAP_GID: "{{ paperless_ng_group_id }}"
+ PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}"
+ restart_policy: unless-stopped
+ memory: "{{ paperless_ng_ui_memory }}"
+ networks:
+ - name: "{{ paperless_ng_network_name }}"
+ network_mode: "{{ paperless_ng_network_name }}"
+ labels:
+ traefik.enable: "{{ paperless_ng_available_externally | string }}"
+ traefik.http.routers.paperless_ng.rule: "Host(`{{ paperless_ng_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.paperless_ng.tls.certresolver: "letsencrypt"
+ traefik.http.routers.paperless_ng.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.paperless_ng.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.paperless_ng.loadbalancer.server.port: "8080"
+ when: paperless_ng_enabled is true
-- name: Create paperless_ng UI Docker Container
- docker_container:
- name: "{{ paperless_ng_container_name_uiserver }}"
- image: jonaswinkler/paperless-ng:latest
- pull: true
- volumes:
- - "{{ paperless_ng_data_directory }}:/usr/src/paperless/data"
- - "{{ paperless_ng_media_directory }}:/usr/src/paperless/media"
- - "{{ paperless_ng_export_directory }}:/usr/src/paperless/export"
- - "{{ paperless_ng_consume_directory }}:/usr/src/paperless/consume"
- ports:
- - "{{ paperless_ng_port }}:8000"
- env:
- PAPERLESS_REDIS: "redis://{{ paperless_ng_container_name_redis | string }}:6379"
- PAPERLESS_DBHOST: "{{ paperless_ng_container_name_postgres | string }}"
- USERMAP_UID: "{{ paperless_ng_user_id }}"
- USERMAP_GID: "{{ paperless_ng_group_id }}"
- PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}"
- restart_policy: unless-stopped
- memory: "{{ paperless_ng_ui_memory }}"
- networks:
- - name: "{{ paperless_ng_container_network_name }}"
+- name: Stop paperless_ng
+ block:
+ - name: Stop paperless_ng
+ community.docker.docker_container:
+ name: "{{ paperless_ng_uiserver_container_name }}"
+ state: absent
+ - name: Stop paperless_ng redis
+ community.docker.docker_container:
+ name: "{{ paperless_ng_redis_container_name }}"
+ state: absent
+ - name: Stop paperless_ng db
+ community.docker.docker_container:
+ name: "{{ paperless_ng_db_container_name }}"
+ state: absent
+ when: paperless_ng_enabled is false
diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml
index 82a9add6..efdcfd7c 100644
--- a/roles/piwigo/defaults/main.yml
+++ b/roles/piwigo/defaults/main.yml
@@ -18,8 +18,17 @@ piwigo_photos_permission: "rw"
# network
piwigo_hostname: "piwigo"
+piwigo_network_name: "piwigo"
piwigo_port: "16923"
+# docker
+piwigo_db_container_name: "piwigo-db"
+piwigo_db_image_name: "mysql"
+piwigo_db_image_version: "5.7"
+piwigo_container_name: "piwigo"
+piwigo_image_name: "linuxserver/piwigo"
+piwigo_image_version: "latest"
+
# specs
piwigo_memory: "1g"
piwigo_mysql_memory: "1g"
diff --git a/roles/piwigo/molecule/default/molecule.yml b/roles/piwigo/molecule/default/molecule.yml
new file mode 100644
index 00000000..33909c29
--- /dev/null
+++ b/roles/piwigo/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ piwigo_enabled: true
diff --git a/roles/piwigo/molecule/default/side_effect.yml b/roles/piwigo/molecule/default/side_effect.yml
new file mode 100644
index 00000000..b100aed6
--- /dev/null
+++ b/roles/piwigo/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ piwigo_enabled: false
diff --git a/roles/piwigo/molecule/default/verify.yml b/roles/piwigo/molecule/default/verify.yml
new file mode 100644
index 00000000..32343069
--- /dev/null
+++ b/roles/piwigo/molecule/default/verify.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get piwigo db container state
+ community.docker.docker_container:
+ name: "{{ piwigo_db_container_name }}"
+ register: result_db
+
+ - name: Get piwigo container state
+ community.docker.docker_container:
+ name: "{{ piwigo_container_name }}"
+ register: result
+
+ - name: Check if piwigo containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
+ - result_db.container['State']['Status'] == "running"
+ - result_db.container['State']['Restarting'] == false
diff --git a/roles/piwigo/molecule/default/verify_stopped.yml b/roles/piwigo/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..750ae3d4
--- /dev/null
+++ b/roles/piwigo/molecule/default/verify_stopped.yml
@@ -0,0 +1,26 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove piwigo
+ community.docker.docker_container:
+ name: "{{ piwigo_container_name }}"
+ state: absent
+ register: result
+
+ - name: Try and stop and remove piwigo db
+ community.docker.docker_container:
+ name: "{{ piwigo_db_container_name }}"
+ state: absent
+ register: result_db
+
+ - name: Check if piwigo is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
+ - not result_db.changed
diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml
index 67c02ea9..9c5dd0de 100644
--- a/roles/piwigo/tasks/main.yml
+++ b/roles/piwigo/tasks/main.yml
@@ -1,51 +1,76 @@
---
-- name: Create Piwigo Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ piwigo_config_directory }}"
- - "{{ piwigo_data_directory }}"
- - "{{ piwigo_photos }}"
+- name: Start Piwigo
+ block:
+ - name: Create Piwigo Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ piwigo_config_directory }}"
+ - "{{ piwigo_data_directory }}"
+ - "{{ piwigo_photos }}"
-- name: Create MySQL container for Piwigo
- docker_container:
- name: piwigo-mysql
- image: mysql:5.7
- pull: true
- volumes:
- - "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw"
- env:
- MYSQL_DATABASE: "piwigo"
- MYSQL_USER: "{{ piwigo_mysql_user }}"
- MYSQL_PASSWORD: "{{ piwigo_mysql_password }}"
- MYSQL_ROOT_PASSWORD: "{{ piwigo_mysql_root_password }}"
- restart_policy: unless-stopped
- memory: "{{ piwigo_mysql_memory }}"
+ - name: Create Piwigo network
+ community.docker.docker_network:
+ name: "{{ piwigo_network_name }}"
-- name: Piwigo Docker Container
- docker_container:
- name: piwigo
- image: linuxserver/piwigo
- pull: true
- volumes:
- - "{{ piwigo_config_directory }}:/config:rw"
- - "{{ piwigo_photos }}:/gallery:rw"
- links:
- - piwigo-mysql:db
- ports:
- - "{{ piwigo_port }}:80"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ piwigo_user_id }}"
- PGID: "{{ piwigo_group_id }}"
- VERSION: "{{ piwigo_version }}"
- restart_policy: unless-stopped
- memory: "{{ piwigo_memory }}"
- labels:
- traefik.enable: "{{ piwigo_available_externally | string }}"
- traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.piwigo.tls.certresolver: "letsencrypt"
- traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.piwigo.loadbalancer.server.port: "80"
+ - name: Create MySQL container for Piwigo
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ piwigo_db_container_name }}"
+ image: "{{ piwigo_db_image_name }}:{{ piwigo_db_image_version }}"
+ pull: true
+ volumes:
+ - "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw"
+ env:
+ MYSQL_DATABASE: "piwigo"
+ MYSQL_USER: "{{ piwigo_mysql_user }}"
+ MYSQL_PASSWORD: "{{ piwigo_mysql_password }}"
+ MYSQL_ROOT_PASSWORD: "{{ piwigo_mysql_root_password }}"
+ restart_policy: unless-stopped
+ memory: "{{ piwigo_mysql_memory }}"
+ networks:
+ - name: "{{ piwigo_network_name }}"
+ network_mode: "{{ piwigo_network_name }}"
+
+ - name: Piwigo Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ piwigo_container_name }}"
+ image: "{{ piwigo_image_name }}:{{ piwigo_image_version }}"
+ pull: true
+ volumes:
+ - "{{ piwigo_config_directory }}:/config:rw"
+ - "{{ piwigo_photos }}:/gallery:rw"
+ ports:
+ - "{{ piwigo_port }}:80"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ piwigo_user_id }}"
+ PGID: "{{ piwigo_group_id }}"
+ VERSION: "{{ piwigo_version }}"
+ restart_policy: unless-stopped
+ memory: "{{ piwigo_memory }}"
+ networks:
+ - name: "{{ piwigo_network_name }}"
+ network_mode: "{{ piwigo_network_name }}"
+ labels:
+ traefik.enable: "{{ piwigo_available_externally | string }}"
+ traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.piwigo.tls.certresolver: "letsencrypt"
+ traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.piwigo.loadbalancer.server.port: "80"
+ when: piwigo_enabled is true
+
+- name: Stop Piwigo
+ block:
+ - name: Stop Piwigo
+ community.docker.docker_container:
+ name: "{{ piwigo_container_name }}"
+ state: absent
+ - name: Stop Piwigo Db
+ community.docker.docker_container:
+ name: "{{ piwigo_db_container_name }}"
+ state: absent
+ when: piwigo_enabled is false
diff --git a/roles/plex/defaults/main.yml b/roles/plex/defaults/main.yml
index 220ebb6b..a53135ca 100644
--- a/roles/plex/defaults/main.yml
+++ b/roles/plex/defaults/main.yml
@@ -28,6 +28,11 @@ plex_audiobooks_permissions: "rw"
# network
plex_hostname: "plex"
+# docker
+plex_container_name: "plex"
+plex_image_name: "linuxserver/plex"
+plex_image_version: "latest"
+
# specs
plex_memory: "2g"
diff --git a/roles/plex/molecule/default/molecule.yml b/roles/plex/molecule/default/molecule.yml
new file mode 100644
index 00000000..4611624d
--- /dev/null
+++ b/roles/plex/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ plex_enabled: true
diff --git a/roles/plex/molecule/default/side_effect.yml b/roles/plex/molecule/default/side_effect.yml
new file mode 100644
index 00000000..597eb871
--- /dev/null
+++ b/roles/plex/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ plex_enabled: false
diff --git a/roles/plex/molecule/default/verify.yml b/roles/plex/molecule/default/verify.yml
new file mode 100644
index 00000000..d971c288
--- /dev/null
+++ b/roles/plex/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get plex container state
+ community.docker.docker_container:
+ name: "{{ plex_container_name }}"
+ register: result
+
+ - name: Check if plex containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/plex/molecule/default/verify_stopped.yml b/roles/plex/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..37859b3c
--- /dev/null
+++ b/roles/plex/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove plex
+ community.docker.docker_container:
+ name: "{{ plex_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if plex is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/plex/tasks/main.yml b/roles/plex/tasks/main.yml
index b22961a8..7597d22c 100644
--- a/roles/plex/tasks/main.yml
+++ b/roles/plex/tasks/main.yml
@@ -1,40 +1,52 @@
---
-- name: Create Plex Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ plex_config_directory }}"
- - "{{ plex_logs }}"
+- name: Start Plex
+ block:
+ - name: Create Plex Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ plex_config_directory }}"
+ - "{{ plex_logs }}"
-- name: Create Plex Docker Container
- docker_container:
- name: plex
- image: linuxserver/plex
- pull: true
- volumes:
- - "{{ plex_config_directory }}:/config:rw"
- - "{{ plex_logs }}:/opt/plex/Library/Application Support/Plex Media Server/Logs:rw"
- - "{{ plex_movies_directory }}:/movies:{{ plex_movies_permissions }}"
- - "{{ plex_tv_directory }}:/tv:{{ plex_tv_permissions }}"
- - "{{ plex_photos_directory }}:/photos:{{ plex_photos_permissions }}"
- - "{{ plex_podcasts_directory }}:/podcasts:{{ plex_podcasts_permissions }}"
- - "{{ plex_music_directory }}:/music:{{ plex_music_permissions }}"
- - "{{ plex_audiobooks_directory }}:/audiobooks:{{ plex_audiobooks_permissions }}"
- network_mode: "host"
- devices: "{{ plex_devices | default(omit) }}"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ plex_user_id }}"
- PGID: "{{ plex_group_id }}"
- VERSION: "{{ plex_version }}"
- restart_policy: unless-stopped
- memory: "{{ plex_memory }}"
- labels:
- traefik.enable: "{{ plex_available_externally | string }}"
- traefik.http.routers.plex.rule: "Host(`{{ plex_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.plex.tls.certresolver: "letsencrypt"
- traefik.http.routers.plex.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.plex.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.plex.loadbalancer.server.port: "32400"
+ - name: Create Plex Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ plex_container_name }}"
+ image: "{{ plex_image_name }}:{{ plex_image_version }}"
+ pull: true
+ volumes:
+ - "{{ plex_config_directory }}:/config:rw"
+ - "{{ plex_logs }}:/opt/plex/Library/Application Support/Plex Media Server/Logs:rw"
+ - "{{ plex_movies_directory }}:/movies:{{ plex_movies_permissions }}"
+ - "{{ plex_tv_directory }}:/tv:{{ plex_tv_permissions }}"
+ - "{{ plex_photos_directory }}:/photos:{{ plex_photos_permissions }}"
+ - "{{ plex_podcasts_directory }}:/podcasts:{{ plex_podcasts_permissions }}"
+ - "{{ plex_music_directory }}:/music:{{ plex_music_permissions }}"
+ - "{{ plex_audiobooks_directory }}:/audiobooks:{{ plex_audiobooks_permissions }}"
+ network_mode: "host"
+ devices: "{{ plex_devices | default(omit) }}"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ plex_user_id }}"
+ PGID: "{{ plex_group_id }}"
+ VERSION: "{{ plex_version }}"
+ restart_policy: unless-stopped
+ memory: "{{ plex_memory }}"
+ labels:
+ traefik.enable: "{{ plex_available_externally | string }}"
+ traefik.http.routers.plex.rule: "Host(`{{ plex_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.plex.tls.certresolver: "letsencrypt"
+ traefik.http.routers.plex.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.plex.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.plex.loadbalancer.server.port: "32400"
+ when: plex_enabled is true
+
+- name: Stop Plex
+ block:
+ - name: Stop Plex
+ community.docker.docker_container:
+ name: "{{ plex_container_name }}"
+ state: absent
+ when: plex_enabled is false
diff --git a/roles/portainer/defaults/main.yml b/roles/portainer/defaults/main.yml
index 7c3443d6..e5dd8138 100644
--- a/roles/portainer/defaults/main.yml
+++ b/roles/portainer/defaults/main.yml
@@ -9,5 +9,10 @@ portainer_data_directory: "{{ docker_home }}/portainer/config"
portainer_port: "9000"
portainer_hostname: "portainer"
+# docker
+portainer_container_name: "portainer"
+portainer_image_name: "portainer/portainer-ce"
+portainer_image_version: "latest"
+
# specs
portainer_memory: 1g
diff --git a/roles/portainer/molecule/default/molecule.yml b/roles/portainer/molecule/default/molecule.yml
new file mode 100644
index 00000000..9c88debc
--- /dev/null
+++ b/roles/portainer/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ portainer_enabled: true
diff --git a/roles/portainer/molecule/default/side_effect.yml b/roles/portainer/molecule/default/side_effect.yml
new file mode 100644
index 00000000..db6a99fb
--- /dev/null
+++ b/roles/portainer/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ portainer_enabled: false
diff --git a/roles/portainer/molecule/default/verify.yml b/roles/portainer/molecule/default/verify.yml
new file mode 100644
index 00000000..a53be8a4
--- /dev/null
+++ b/roles/portainer/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get portainer container state
+ community.docker.docker_container:
+ name: "{{ portainer_container_name }}"
+ register: result
+
+ - name: Check if portainer containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/portainer/molecule/default/verify_stopped.yml b/roles/portainer/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..5add0bf7
--- /dev/null
+++ b/roles/portainer/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove portainer
+ community.docker.docker_container:
+ name: "{{ portainer_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if portainer is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/portainer/tasks/main.yml b/roles/portainer/tasks/main.yml
index 5c343029..cf0c3876 100644
--- a/roles/portainer/tasks/main.yml
+++ b/roles/portainer/tasks/main.yml
@@ -1,28 +1,39 @@
---
-- name: Create Portainer Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ portainer_data_directory }}"
+- name: Start Portainer
+ block:
+ - name: Create Portainer Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ portainer_data_directory }}"
-- name: Portainer Docker Container
- docker_container:
- name: portainer
- image: portainer/portainer-ce
- pull: true
- volumes:
- - "{{ portainer_data_directory }}:/data:rw"
- - "/var/run/docker.sock:/var/run/docker.sock:ro"
- - "/etc/timezone:/etc/timezone:ro"
- ports:
- - "{{ portainer_port }}:9443"
- restart_policy: unless-stopped
- memory: "{{ portainer_memory }}"
- labels:
- traefik.enable: "{{ portainer_available_externally | string }}"
- traefik.http.routers.portainer.rule: "Host(`{{ portainer_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.portainer.tls.certresolver: "letsencrypt"
- traefik.http.routers.portainer.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.portainer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.portainer.loadbalancer.server.port: "9443"
+ - name: Portainer Docker Container
+ community.docker.docker_container:
+ name: "{{ portainer_container_name }}"
+ image: "{{ portainer_image_name }}:{{ portainer_image_version }}"
+ pull: true
+ volumes:
+ - "{{ portainer_data_directory }}:/data:rw"
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
+ - "/etc/timezone:/etc/timezone:ro"
+ ports:
+ - "{{ portainer_port }}:9443"
+ restart_policy: unless-stopped
+ memory: "{{ portainer_memory }}"
+ labels:
+ traefik.enable: "{{ portainer_available_externally | string }}"
+ traefik.http.routers.portainer.rule: "Host(`{{ portainer_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.portainer.tls.certresolver: "letsencrypt"
+ traefik.http.routers.portainer.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.portainer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.portainer.loadbalancer.server.port: "9443"
+ when: portainer_enabled is true
+
+- name: Stop Portainer
+ block:
+ - name: Stop Portainer
+ community.docker.docker_container:
+ name: "{{ portainer_container_name }}"
+ state: absent
+ when: portainer_enabled is false
diff --git a/roles/prowlarr/defaults/main.yml b/roles/prowlarr/defaults/main.yml
index dc47b86e..fbb072cf 100644
--- a/roles/prowlarr/defaults/main.yml
+++ b/roles/prowlarr/defaults/main.yml
@@ -13,5 +13,10 @@ prowlarr_group_id: "0"
prowlarr_port: "9696"
prowlarr_hostname: "prowlarr"
+# docker
+prowlarr_container_name: "prowlarr"
+prowlarr_image_name: "ghcr.io/linuxserver/prowlarr"
+prowlarr_image_version: "develop"
+
# specs
prowlarr_memory: 1g
diff --git a/roles/prowlarr/molecule/default/molecule.yml b/roles/prowlarr/molecule/default/molecule.yml
new file mode 100644
index 00000000..4d2be851
--- /dev/null
+++ b/roles/prowlarr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ prowlarr_enabled: true
diff --git a/roles/prowlarr/molecule/default/side_effect.yml b/roles/prowlarr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..e7cfcab4
--- /dev/null
+++ b/roles/prowlarr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ prowlarr_enabled: false
diff --git a/roles/prowlarr/molecule/default/verify.yml b/roles/prowlarr/molecule/default/verify.yml
new file mode 100644
index 00000000..30a19ec6
--- /dev/null
+++ b/roles/prowlarr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get prowlarr container state
+ community.docker.docker_container:
+ name: "{{ prowlarr_container_name }}"
+ register: result
+
+ - name: Check if prowlarr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/prowlarr/molecule/default/verify_stopped.yml b/roles/prowlarr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..67d63e38
--- /dev/null
+++ b/roles/prowlarr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove prowlarr
+ community.docker.docker_container:
+ name: "{{ prowlarr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if prowlarr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/prowlarr/tasks/main.yml b/roles/prowlarr/tasks/main.yml
index c4f9c480..7bc8726e 100644
--- a/roles/prowlarr/tasks/main.yml
+++ b/roles/prowlarr/tasks/main.yml
@@ -1,30 +1,42 @@
---
-- name: Create Prowlarr Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ prowlarr_data_directory }}"
+- name: Start Prowlarr
+ block:
+ - name: Create Prowlarr Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ prowlarr_data_directory }}"
-- name: Create Prowlarr Docker Container
- docker_container:
- name: prowlarr
- image: ghcr.io/linuxserver/prowlarr:develop
- pull: true
- volumes:
- - "{{ prowlarr_data_directory }}:/config:rw"
- ports:
- - "{{ prowlarr_port }}:9696"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ prowlarr_user_id }}"
- PGID: "{{ prowlarr_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ prowlarr_memory }}"
- labels:
- traefik.enable: "{{ prowlarr_available_externally | string }}"
- traefik.http.routers.prowlarr.rule: "Host(`{{ prowlarr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.prowlarr.tls.certresolver: "letsencrypt"
- traefik.http.routers.prowlarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.prowlarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.prowlarr.loadbalancer.server.port: "9696"
+ - name: Create Prowlarr Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ prowlarr_container_name }}"
+ image: "{{ prowlarr_image_name }}:{{ prowlarr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ prowlarr_data_directory }}:/config:rw"
+ ports:
+ - "{{ prowlarr_port }}:9696"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ prowlarr_user_id }}"
+ PGID: "{{ prowlarr_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ prowlarr_memory }}"
+ labels:
+ traefik.enable: "{{ prowlarr_available_externally | string }}"
+ traefik.http.routers.prowlarr.rule: "Host(`{{ prowlarr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.prowlarr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.prowlarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.prowlarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.prowlarr.loadbalancer.server.port: "9696"
+ when: prowlarr_enabled is true
+
+- name: Stop Prowlarr
+ block:
+ - name: Stop Prowlarr
+ community.docker.docker_container:
+ name: "{{ prowlarr_container_name }}"
+ state: absent
+ when: prowlarr_enabled is false
diff --git a/roles/pyload/defaults/main.yml b/roles/pyload/defaults/main.yml
index 6da3d9b7..3e30a361 100644
--- a/roles/pyload/defaults/main.yml
+++ b/roles/pyload/defaults/main.yml
@@ -14,5 +14,10 @@ pyload_group_id: "0"
pyload_hostname: "pyload"
pyload_port: "8000"
+# docker
+pyload_container_name: "pyload"
+pyload_image_name: "writl/pyload"
+pyload_image_version: "latest"
+
# specs
pyload_memory: "1g"
diff --git a/roles/pyload/molecule/default/molecule.yml b/roles/pyload/molecule/default/molecule.yml
new file mode 100644
index 00000000..141f9e4b
--- /dev/null
+++ b/roles/pyload/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ pyload_enabled: true
diff --git a/roles/pyload/molecule/default/side_effect.yml b/roles/pyload/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f609d9e3
--- /dev/null
+++ b/roles/pyload/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ pyload_enabled: false
diff --git a/roles/pyload/molecule/default/verify.yml b/roles/pyload/molecule/default/verify.yml
new file mode 100644
index 00000000..f6183b3c
--- /dev/null
+++ b/roles/pyload/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get pyload container state
+ community.docker.docker_container:
+ name: "{{ pyload_container_name }}"
+ register: result
+
+ - name: Check if pyload containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/pyload/molecule/default/verify_stopped.yml b/roles/pyload/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..d340dfb4
--- /dev/null
+++ b/roles/pyload/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove pyload
+ community.docker.docker_container:
+ name: "{{ pyload_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if pyload is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/pyload/tasks/main.yml b/roles/pyload/tasks/main.yml
index 39d7a2e2..79ea4e6c 100644
--- a/roles/pyload/tasks/main.yml
+++ b/roles/pyload/tasks/main.yml
@@ -1,33 +1,45 @@
---
-- name: Create pyLoad Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ pyload_config_directory }}"
- - "{{ pyload_download_directory }}"
+- name: Start pyLoad
+ block:
+ - name: Create pyLoad Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ pyload_config_directory }}"
+ - "{{ pyload_download_directory }}"
-- name: Create pyLoad Docker Container
- docker_container:
- name: pyload
- image: writl/pyload
- pull: true
- volumes:
- - "{{ pyload_config_directory }}:/opt/pyload/pyload-config:rw"
- - "{{ pyload_download_directory }}:/opt/pyload/Downloads:rw"
- ports:
- - "{{ pyload_port }}:8000"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- UID: "{{ pyload_user_id }}"
- GID: "{{ pyload_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ pyload_memory }}"
- labels:
- traefik.enable: "{{ pyload_available_externally | string }}"
- traefik.http.routers.pyload.rule: "Host(`{{ pyload_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.pyload.tls.certresolver: "letsencrypt"
- traefik.http.routers.pyload.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.pyload.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.pyload.loadbalancer.server.port: "8000"
+ - name: Create pyLoad Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ pyload_container_name }}"
+ image: "{{ pyload_image_name }}:{{ pyload_image_version }}"
+ pull: true
+ volumes:
+ - "{{ pyload_config_directory }}:/opt/pyload/pyload-config:rw"
+ - "{{ pyload_download_directory }}:/opt/pyload/Downloads:rw"
+ ports:
+ - "{{ pyload_port }}:8000"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ UID: "{{ pyload_user_id }}"
+ GID: "{{ pyload_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ pyload_memory }}"
+ labels:
+ traefik.enable: "{{ pyload_available_externally | string }}"
+ traefik.http.routers.pyload.rule: "Host(`{{ pyload_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.pyload.tls.certresolver: "letsencrypt"
+ traefik.http.routers.pyload.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.pyload.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.pyload.loadbalancer.server.port: "8000"
+ when: pyload_enabled is true
+
+- name: Stop pyLoad
+ block:
+ - name: Stop pyLoad
+ community.docker.docker_container:
+ name: "{{ pyload_container_name }}"
+ state: absent
+ when: pyload_enabled is false
diff --git a/roles/pytivo/defaults/main.yml b/roles/pytivo/defaults/main.yml
index b223e71a..79a1ff5e 100644
--- a/roles/pytivo/defaults/main.yml
+++ b/roles/pytivo/defaults/main.yml
@@ -16,3 +16,8 @@ pytivo_group_id: "0"
# network
pytivo_hostname: "pytivo"
+
+# docker
+pytivo_container_name: "pytivo"
+pytivo_image_name: "pinion/docker-pytivo"
+pytivo_image_version: "latest"
diff --git a/roles/pytivo/molecule/default/molecule.yml b/roles/pytivo/molecule/default/molecule.yml
new file mode 100644
index 00000000..7613679b
--- /dev/null
+++ b/roles/pytivo/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ pytivo_enabled: true
diff --git a/roles/pytivo/molecule/default/side_effect.yml b/roles/pytivo/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5716e84b
--- /dev/null
+++ b/roles/pytivo/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ pytivo_enabled: false
diff --git a/roles/pytivo/molecule/default/verify.yml b/roles/pytivo/molecule/default/verify.yml
new file mode 100644
index 00000000..b185c872
--- /dev/null
+++ b/roles/pytivo/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get pytivo container state
+ community.docker.docker_container:
+ name: "{{ pytivo_container_name }}"
+ register: result
+
+ - name: Check if pytivo containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/pytivo/molecule/default/verify_stopped.yml b/roles/pytivo/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..591d3867
--- /dev/null
+++ b/roles/pytivo/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove pytivo
+ community.docker.docker_container:
+ name: "{{ pytivo_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if pytivo is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/pytivo/tasks/main.yml b/roles/pytivo/tasks/main.yml
index 219d93cb..2e74270c 100644
--- a/roles/pytivo/tasks/main.yml
+++ b/roles/pytivo/tasks/main.yml
@@ -1,38 +1,50 @@
---
-- name: Create Pytivo Directories
- file:
- path: "{{ item }}"
- state: directory
- mode: 0777
- with_items:
- - "{{ pytivo_config_directory }}"
+- name: Start Pytivo
+ block:
+ - name: Create Pytivo Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ mode: 0777
+ with_items:
+ - "{{ pytivo_config_directory }}"
-- name: Pytivo
- docker_container:
- name: pytivo
- image: pinion/docker-pytivo
- pull: true
- volumes:
- - "/etc/localtime:/etc/localtime:ro"
- - "{{ pytivo_config_directory }}:/config:rw"
- - "{{ pytivo_movies_directory }}:/movies:ro"
- - "{{ pytivo_tv_directory }}:/tv:ro"
- - "{{ pytivo_photos_directory }}:/photos:ro"
- - "{{ pytivo_music_directory }}:/music:ro"
- - "{{ pytivo_podcasts_directory }}:/podcasts:ro"
- ports:
- - "9032:9032"
- - "2190:2190/udp"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ pytivo_user_id }}"
- PGID: "{{ pytivo_group_id }}"
- restart_policy: unless-stopped
- memory: 1g
- labels:
- traefik.enable: "{{ pytivo_available_externally | string }}"
- traefik.http.routers.pytivo.rule: "Host(`{{ pytivo_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.pytivo.tls.certresolver: "letsencrypt"
- traefik.http.routers.pytivo.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.pytivo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.pytivo.loadbalancer.server.port: "9032"
+ - name: Pytivo
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ pytivo_container_name }}"
+ image: "{{ pytivo_image_name }}:{{ pytivo_image_version }}"
+ pull: true
+ volumes:
+ - "/etc/localtime:/etc/localtime:ro"
+ - "{{ pytivo_config_directory }}:/config:rw"
+ - "{{ pytivo_movies_directory }}:/movies:ro"
+ - "{{ pytivo_tv_directory }}:/tv:ro"
+ - "{{ pytivo_photos_directory }}:/photos:ro"
+ - "{{ pytivo_music_directory }}:/music:ro"
+ - "{{ pytivo_podcasts_directory }}:/podcasts:ro"
+ ports:
+ - "9032:9032"
+ - "2190:2190/udp"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ pytivo_user_id }}"
+ PGID: "{{ pytivo_group_id }}"
+ restart_policy: unless-stopped
+ memory: 1g
+ labels:
+ traefik.enable: "{{ pytivo_available_externally | string }}"
+ traefik.http.routers.pytivo.rule: "Host(`{{ pytivo_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.pytivo.tls.certresolver: "letsencrypt"
+ traefik.http.routers.pytivo.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.pytivo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.pytivo.loadbalancer.server.port: "9032"
+ when: pytivo_enabled is true
+
+- name: Stop Pytivo
+ block:
+ - name: Stop Pytivo
+ community.docker.docker_container:
+ name: "{{ pytivo_container_name }}"
+ state: absent
+ when: pytivo_enabled is false
diff --git a/roles/radarr/defaults/main.yml b/roles/radarr/defaults/main.yml
index 843520b7..f77a6329 100644
--- a/roles/radarr/defaults/main.yml
+++ b/roles/radarr/defaults/main.yml
@@ -15,5 +15,10 @@ radarr_group_id: "0"
radarr_port: "7878"
radarr_hostname: "radarr"
+# docker
+radarr_container_name: "radarr"
+radarr_image_name: "linuxserver/radarr"
+radarr_image_version: "latest"
+
# specs
radarr_memory: 1g
diff --git a/roles/radarr/molecule/default/molecule.yml b/roles/radarr/molecule/default/molecule.yml
new file mode 100644
index 00000000..cadf085b
--- /dev/null
+++ b/roles/radarr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ radarr_enabled: true
diff --git a/roles/radarr/molecule/default/side_effect.yml b/roles/radarr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..d172923e
--- /dev/null
+++ b/roles/radarr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ radarr_enabled: false
diff --git a/roles/radarr/molecule/default/verify.yml b/roles/radarr/molecule/default/verify.yml
new file mode 100644
index 00000000..5083dada
--- /dev/null
+++ b/roles/radarr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get radarr container state
+ community.docker.docker_container:
+ name: "{{ radarr_container_name }}"
+ register: result
+
+ - name: Check if radarr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/radarr/molecule/default/verify_stopped.yml b/roles/radarr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..fd1f933e
--- /dev/null
+++ b/roles/radarr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove radarr
+ community.docker.docker_container:
+ name: "{{ radarr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if radarr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/radarr/tasks/main.yml b/roles/radarr/tasks/main.yml
index c7b1dad8..c13cdeaa 100644
--- a/roles/radarr/tasks/main.yml
+++ b/roles/radarr/tasks/main.yml
@@ -1,32 +1,44 @@
---
-- name: Create Radarr Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ radarr_data_directory }}"
+- name: Start Radarr
+ block:
+ - name: Create Radarr Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ radarr_data_directory }}"
-- name: Radarr
- docker_container:
- name: radarr
- image: linuxserver/radarr
- pull: true
- volumes:
- - "{{ radarr_movies_directory }}:/movies:rw"
- - "{{ radarr_download_directory }}:/downloads:rw"
- - "{{ radarr_data_directory }}:/config:rw"
- ports:
- - "{{ radarr_port }}:7878"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ radarr_user_id }}"
- PGID: "{{ radarr_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ radarr_memory }}"
- labels:
- traefik.enable: "{{ radarr_available_externally | string }}"
- traefik.http.routers.radarr.rule: "Host(`{{ radarr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.radarr.tls.certresolver: "letsencrypt"
- traefik.http.routers.radarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.radarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.radarr.loadbalancer.server.port: "7878"
+ - name: Radarr
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ radarr_container_name }}"
+ image: "{{ radarr_image_name }}:{{ radarr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ radarr_movies_directory }}:/movies:rw"
+ - "{{ radarr_download_directory }}:/downloads:rw"
+ - "{{ radarr_data_directory }}:/config:rw"
+ ports:
+ - "{{ radarr_port }}:7878"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ radarr_user_id }}"
+ PGID: "{{ radarr_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ radarr_memory }}"
+ labels:
+ traefik.enable: "{{ radarr_available_externally | string }}"
+ traefik.http.routers.radarr.rule: "Host(`{{ radarr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.radarr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.radarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.radarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.radarr.loadbalancer.server.port: "7878"
+ when: radarr_enabled is true
+
+- name: Stop Radarr
+ block:
+ - name: Stop Radarr
+ community.docker.docker_container:
+ name: "{{ radarr_container_name }}"
+ state: absent
+ when: radarr_enabled is false
diff --git a/roles/route53_ddns/defaults/main.yml b/roles/route53_ddns/defaults/main.yml
index 06507ad0..ea3638ce 100644
--- a/roles/route53_ddns/defaults/main.yml
+++ b/roles/route53_ddns/defaults/main.yml
@@ -23,3 +23,6 @@ route53_schedule: "*/30 * * * *"
# Container
route53_memory: 512MB
+route53_container_name: "route53-ddns"
+route53_image_name: "crazymax/ddns-route53"
+route53_image_version: "latest"
diff --git a/roles/route53_ddns/molecule/default/molecule.yml b/roles/route53_ddns/molecule/default/molecule.yml
new file mode 100644
index 00000000..fee9222f
--- /dev/null
+++ b/roles/route53_ddns/molecule/default/molecule.yml
@@ -0,0 +1,19 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ route53_enabled: true
+ route53_key_id: "abcdef"
+ route53_secret_key: "ghijkl"
+ route53_hosted_zone_id: "1000"
+ route53_data_directory: "/tmp/route53"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp:rw
+ privileged: true
+ pre_build_image: true
diff --git a/roles/route53_ddns/molecule/default/side_effect.yml b/roles/route53_ddns/molecule/default/side_effect.yml
new file mode 100644
index 00000000..4ef789f9
--- /dev/null
+++ b/roles/route53_ddns/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ route53_enabled: false
diff --git a/roles/route53_ddns/molecule/default/verify.yml b/roles/route53_ddns/molecule/default/verify.yml
new file mode 100644
index 00000000..f64de7d7
--- /dev/null
+++ b/roles/route53_ddns/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get route53 container state
+ community.docker.docker_container:
+ name: "{{ route53_container_name }}"
+ register: result
+
+ - name: Check if route53 containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/route53_ddns/molecule/default/verify_stopped.yml b/roles/route53_ddns/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..114d5657
--- /dev/null
+++ b/roles/route53_ddns/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove route53
+ community.docker.docker_container:
+ name: "{{ route53_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if route53 is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/route53_ddns/tasks/main.yml b/roles/route53_ddns/tasks/main.yml
index 20c0ad2e..df25e460 100644
--- a/roles/route53_ddns/tasks/main.yml
+++ b/roles/route53_ddns/tasks/main.yml
@@ -1,25 +1,36 @@
---
+- name: Start AWS Route53 Dynamic DNS
+ block:
+ - name: Create AWS Route53 Dynamic DNS Directories
+ ansible.builtin.file:
+ path: "{{ route53_data_directory }}"
+ state: directory
-- name: Create AWS Route53 Dynamic DNS Directories
- file:
- path: "{{ route53_data_directory }}"
- state: directory
+ - name: Generate AWS Route53 Dynamic DNS config file
+ template:
+ src: config.yml
+ dest: "{{ route53_data_directory }}/ddns-route53.yml"
+ register: template_config
-- name: Generate AWS Route53 Dynamic DNS config file
- template:
- src: config.yml
- dest: "{{ route53_data_directory }}/ddns-route53.yml"
- register: template_config
+ - name: AWS Route53 Dynamic DNS Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ route53_container_name }}"
+ image: "{{ route53_image_name }}:{{ route53_image_version }}"
+ pull: true
+ env:
+ SCHEDULE: "{{ route53_schedule | string }}"
+ volumes:
+ - "{{ route53_data_directory }}/ddns-route53.yml:/etc/ddns-route53/ddns-route53.yml"
+ restart_policy: unless-stopped
+ memory: "{{ route53_memory }}"
+ recreate: "{{ template_config is changed }}"
+ when: route53_enabled is true
-- name: AWS Route53 Dynamic DNS Container
- docker_container:
- name: route53-ddns
- image: crazymax/ddns-route53:latest
- pull: true
- env:
- SCHEDULE: "{{ route53_schedule | string }}"
- volumes:
- - "{{ route53_data_directory }}/ddns-route53.yml:/etc/ddns-route53/ddns-route53.yml"
- restart_policy: unless-stopped
- memory: "{{ route53_memory }}"
- recreate: "{{ template_config is changed }}"
+- name: Stop AWS Route53 Dynamic DNS
+ block:
+ - name: Stop AWS Route53 Dynamic DNS
+ community.docker.docker_container:
+ name: "{{ route53_container_name }}"
+ state: absent
+ when: route53_enabled is false
diff --git a/roles/rssbridge/defaults/main.yml b/roles/rssbridge/defaults/main.yml
index 3c02e8a6..6c3e2518 100644
--- a/roles/rssbridge/defaults/main.yml
+++ b/roles/rssbridge/defaults/main.yml
@@ -9,5 +9,10 @@ rssbridge_data_directory: "{{ docker_home }}/rssbridge"
rssbridge_port: "8091"
rssbridge_hostname: "rssbridge"
+# docker
+rssbridge_container_name: "rssbridge"
+rssbridge_image_name: "rssbridge/rss-bridge"
+rssbridge_image_version: "latest"
+
# specs
rssbridge_memory: 1g
diff --git a/roles/rssbridge/molecule/default/molecule.yml b/roles/rssbridge/molecule/default/molecule.yml
new file mode 100644
index 00000000..c044b144
--- /dev/null
+++ b/roles/rssbridge/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ rssbridge_enabled: true
diff --git a/roles/rssbridge/molecule/default/side_effect.yml b/roles/rssbridge/molecule/default/side_effect.yml
new file mode 100644
index 00000000..a073e68b
--- /dev/null
+++ b/roles/rssbridge/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ rssbridge_enabled: false
diff --git a/roles/rssbridge/molecule/default/verify.yml b/roles/rssbridge/molecule/default/verify.yml
new file mode 100644
index 00000000..20bee845
--- /dev/null
+++ b/roles/rssbridge/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get rssbridge container state
+ community.docker.docker_container:
+ name: "{{ rssbridge_container_name }}"
+ register: result
+
+ - name: Check if rssbridge containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/rssbridge/molecule/default/verify_stopped.yml b/roles/rssbridge/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..2c260381
--- /dev/null
+++ b/roles/rssbridge/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove rssbridge
+ community.docker.docker_container:
+ name: "{{ rssbridge_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if rssbridge is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/rssbridge/tasks/main.yml b/roles/rssbridge/tasks/main.yml
index 1c942ce1..73b7e090 100644
--- a/roles/rssbridge/tasks/main.yml
+++ b/roles/rssbridge/tasks/main.yml
@@ -1,27 +1,39 @@
---
-- name: Create RSSBridge Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ rssbridge_data_directory }}/data"
+- name: Start RSSBridge
+ block:
+ - name: Create RSSBridge Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ rssbridge_data_directory }}/data"
-- name: RSSBridge Docker Container
- docker_container:
- name: rssbridge
- image: rssbridge/rss-bridge
- pull: true
- volumes:
- - "{{ rssbridge_data_directory }}/data:/config:rw"
- ports:
- - "{{ rssbridge_port }}:80"
- restart_policy: unless-stopped
- memory: "{{ rssbridge_memory }}"
- labels:
- traefik.enable: "{{ rssbridge_available_externally | string }}"
- traefik.http.routers.rssbridge.rule: "Host(`{{ rssbridge_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.rssbridge.tls.certresolver: "letsencrypt"
- traefik.http.routers.rssbridge.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.rssbridge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.rssbridge.loadbalancer.server.port: "80"
+ - name: RSSBridge Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ rssbridge_container_name }}"
+ image: "{{ rssbridge_image_name }}:{{ rssbridge_image_version }}"
+ pull: true
+ volumes:
+ - "{{ rssbridge_data_directory }}/data:/config:rw"
+ ports:
+ - "{{ rssbridge_port }}:80"
+ restart_policy: unless-stopped
+ memory: "{{ rssbridge_memory }}"
+ labels:
+ traefik.enable: "{{ rssbridge_available_externally | string }}"
+ traefik.http.routers.rssbridge.rule: "Host(`{{ rssbridge_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.rssbridge.tls.certresolver: "letsencrypt"
+ traefik.http.routers.rssbridge.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.rssbridge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.rssbridge.loadbalancer.server.port: "80"
+ when: rssbridge_enabled is true
+
+- name: Stop RSSBridge
+ block:
+ - name: Stop RSSBridge
+ community.docker.docker_container:
+ name: "{{ rssbridge_container_name }}"
+ state: absent
+ when: rssbridge_enabled is false
diff --git a/roles/sabnzbd/defaults/main.yml b/roles/sabnzbd/defaults/main.yml
index 3a39633c..3468a027 100644
--- a/roles/sabnzbd/defaults/main.yml
+++ b/roles/sabnzbd/defaults/main.yml
@@ -17,3 +17,8 @@ sabnzbd_memory: 1g
# uid / gid
sabnzbd_user_id: "0"
sabnzbd_group_id: "0"
+
+# docker
+sabnzbd_container_name: "sabnzbd"
+sabnzbd_image_name: "linuxserver/sabnzbd"
+sabnzbd_image_version: "latest"
diff --git a/roles/sabnzbd/molecule/default/molecule.yml b/roles/sabnzbd/molecule/default/molecule.yml
new file mode 100644
index 00000000..53d52b07
--- /dev/null
+++ b/roles/sabnzbd/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ sabnzbd_enabled: true
diff --git a/roles/sabnzbd/molecule/default/side_effect.yml b/roles/sabnzbd/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f7fe0b8e
--- /dev/null
+++ b/roles/sabnzbd/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ sabnzbd_enabled: false
diff --git a/roles/sabnzbd/molecule/default/verify.yml b/roles/sabnzbd/molecule/default/verify.yml
new file mode 100644
index 00000000..c8f767eb
--- /dev/null
+++ b/roles/sabnzbd/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get sabnzbd container state
+ community.docker.docker_container:
+ name: "{{ sabnzbd_container_name }}"
+ register: result
+
+ - name: Check if sabnzbd containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/sabnzbd/molecule/default/verify_stopped.yml b/roles/sabnzbd/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..d83fa89d
--- /dev/null
+++ b/roles/sabnzbd/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove sabnzbd
+ community.docker.docker_container:
+ name: "{{ sabnzbd_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if sabnzbd is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/sabnzbd/tasks/main.yml b/roles/sabnzbd/tasks/main.yml
index 914769bd..7e5241cd 100644
--- a/roles/sabnzbd/tasks/main.yml
+++ b/roles/sabnzbd/tasks/main.yml
@@ -1,31 +1,43 @@
---
-- name: Create Sabnzbd Data Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ sabnzbd_data_directory }}"
+- name: Start Sabnzbd
+ block:
+ - name: Create Sabnzbd Data Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ sabnzbd_data_directory }}"
-- name: Sabnzbd
- docker_container:
- name: sabnzbd
- image: linuxserver/sabnzbd
- pull: true
- volumes:
- - "{{ sabnzbd_data_directory }}:/config:rw"
- - "{{ sabnzbd_downloads_directory }}:/downloads"
- - "{{ sabnzbd_incomplete_directory }}:/incomplete-downloads"
- ports:
- - "{{ sabnzbd_port }}:8080"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ sabnzbd_user_id }}"
- PGID: "{{ sabnzbd_group_id }}"
- restart_policy: unless-stopped
- labels:
- traefik.enable: "{{ sabnzbd_available_externally | string }}"
- traefik.http.routers.sabnzbd.rule: "Host(`{{ sabnzbd_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.sabnzbd.tls.certresolver: "letsencrypt"
- traefik.http.routers.sabnzbd.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.sabnzbd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.sabnzbd.loadbalancer.server.port: "8080"
+ - name: Sabnzbd
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ sabnzbd_container_name }}"
+ image: "{{ sabnzbd_image_name }}:{{ sabnzbd_image_version }}"
+ pull: true
+ volumes:
+ - "{{ sabnzbd_data_directory }}:/config:rw"
+ - "{{ sabnzbd_downloads_directory }}:/downloads"
+ - "{{ sabnzbd_incomplete_directory }}:/incomplete-downloads"
+ ports:
+ - "{{ sabnzbd_port }}:8080"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ sabnzbd_user_id }}"
+ PGID: "{{ sabnzbd_group_id }}"
+ restart_policy: unless-stopped
+ labels:
+ traefik.enable: "{{ sabnzbd_available_externally | string }}"
+ traefik.http.routers.sabnzbd.rule: "Host(`{{ sabnzbd_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.sabnzbd.tls.certresolver: "letsencrypt"
+ traefik.http.routers.sabnzbd.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.sabnzbd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.sabnzbd.loadbalancer.server.port: "8080"
+ when: sabnzbd_enabled is true
+
+- name: Stop Sabnzbd
+ block:
+ - name: Stop Sabnzbd
+ community.docker.docker_container:
+ name: "{{ sabnzbd_container_name }}"
+ state: absent
+ when: sabnzbd_enabled is false
diff --git a/roles/sickchill/defaults/main.yml b/roles/sickchill/defaults/main.yml
index 483b32d0..e91a12b0 100644
--- a/roles/sickchill/defaults/main.yml
+++ b/roles/sickchill/defaults/main.yml
@@ -15,5 +15,10 @@ sickchill_group_id: "0"
sickchill_port: "8081"
sickchill_hostname: "sickchill"
+# docker
+sickchill_container_name: "sickchill"
+sickchill_image_name: "linuxserver/sickchill"
+sickchill_image_version: "latest"
+
# specs
sickchill_memory: 1g
diff --git a/roles/sickchill/molecule/default/molecule.yml b/roles/sickchill/molecule/default/molecule.yml
new file mode 100644
index 00000000..b0c23f33
--- /dev/null
+++ b/roles/sickchill/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ sickchill_enabled: true
diff --git a/roles/sickchill/molecule/default/side_effect.yml b/roles/sickchill/molecule/default/side_effect.yml
new file mode 100644
index 00000000..08bdee46
--- /dev/null
+++ b/roles/sickchill/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ sickchill_enabled: false
diff --git a/roles/sickchill/molecule/default/verify.yml b/roles/sickchill/molecule/default/verify.yml
new file mode 100644
index 00000000..4a9bc9d1
--- /dev/null
+++ b/roles/sickchill/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get sickchill container state
+ community.docker.docker_container:
+ name: "{{ sickchill_container_name }}"
+ register: result
+
+ - name: Check if sickchill containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/sickchill/molecule/default/verify_stopped.yml b/roles/sickchill/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..6da33063
--- /dev/null
+++ b/roles/sickchill/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove sickchill
+ community.docker.docker_container:
+ name: "{{ sickchill_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if sickchill is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/sickchill/tasks/main.yml b/roles/sickchill/tasks/main.yml
index 4c058a5b..f84dad76 100644
--- a/roles/sickchill/tasks/main.yml
+++ b/roles/sickchill/tasks/main.yml
@@ -1,33 +1,45 @@
---
-- name: Create Sickchill Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ sickchill_config_directory }}"
+- name: Start Sickchill
+ block:
+ - name: Create Sickchill Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ sickchill_config_directory }}"
-- name: Sickchill Docker Container
- docker_container:
- name: sickchill
- image: linuxserver/sickchill
- pull: true
- volumes:
- - "{{ sickchill_config_directory }}:/config:rw"
- - "{{ sickchill_downloads_directory }}:/downloads:rw"
- - "{{ sickchill_tv_directory }}:/tv:rw"
- ports:
- - "{{ sickchill_port }}:8081"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ sickchill_user_id }}"
- PGID: "{{ sickchill_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ sickchill_memory }}"
- labels:
- traefik.enable: "{{ sickchill_available_externally | string }}"
- traefik.http.routers.sickchill.rule: "Host(`{{ sickchill_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.sickchill.tls.certresolver: "letsencrypt"
- traefik.http.routers.sickchill.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.sickchill.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.sickchill.loadbalancer.server.port: "8081"
+ - name: Sickchill Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ sickchill_container_name }}"
+ image: "{{ sickchill_image_name }}:{{ sickchill_image_version }}"
+ pull: true
+ volumes:
+ - "{{ sickchill_config_directory }}:/config:rw"
+ - "{{ sickchill_downloads_directory }}:/downloads:rw"
+ - "{{ sickchill_tv_directory }}:/tv:rw"
+ ports:
+ - "{{ sickchill_port }}:8081"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ sickchill_user_id }}"
+ PGID: "{{ sickchill_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ sickchill_memory }}"
+ labels:
+ traefik.enable: "{{ sickchill_available_externally | string }}"
+ traefik.http.routers.sickchill.rule: "Host(`{{ sickchill_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.sickchill.tls.certresolver: "letsencrypt"
+ traefik.http.routers.sickchill.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.sickchill.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.sickchill.loadbalancer.server.port: "8081"
+ when: sickchill_enabled is true
+
+- name: Stop Sickchill
+ block:
+ - name: Stop Sickchill
+ community.docker.docker_container:
+ name: "{{ sickchill_container_name }}"
+ state: absent
+ when: sickchill_enabled is false
diff --git a/roles/sonarr/defaults/main.yml b/roles/sonarr/defaults/main.yml
index 256f08fc..fe120377 100644
--- a/roles/sonarr/defaults/main.yml
+++ b/roles/sonarr/defaults/main.yml
@@ -15,5 +15,10 @@ sonarr_group_id: "0"
sonarr_port: "8989"
sonarr_hostname: "sonarr"
+# docker
+sonarr_container_name: "sonarr"
+sonarr_image_name: "linuxserver/sonarr"
+sonarr_image_version: "latest"
+
# specs
sonarr_memory: 1g
diff --git a/roles/sonarr/molecule/default/molecule.yml b/roles/sonarr/molecule/default/molecule.yml
new file mode 100644
index 00000000..4c0a6d30
--- /dev/null
+++ b/roles/sonarr/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ sonarr_enabled: true
diff --git a/roles/sonarr/molecule/default/side_effect.yml b/roles/sonarr/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f3aaf103
--- /dev/null
+++ b/roles/sonarr/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ sonarr_enabled: false
diff --git a/roles/sonarr/molecule/default/verify.yml b/roles/sonarr/molecule/default/verify.yml
new file mode 100644
index 00000000..15cbf349
--- /dev/null
+++ b/roles/sonarr/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get sonarr container state
+ community.docker.docker_container:
+ name: "{{ sonarr_container_name }}"
+ register: result
+
+ - name: Check if sonarr containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/sonarr/molecule/default/verify_stopped.yml b/roles/sonarr/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..76a78fcc
--- /dev/null
+++ b/roles/sonarr/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove sonarr
+ community.docker.docker_container:
+ name: "{{ sonarr_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if sonarr is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/sonarr/tasks/main.yml b/roles/sonarr/tasks/main.yml
index 4eeb70fa..3e429e8b 100644
--- a/roles/sonarr/tasks/main.yml
+++ b/roles/sonarr/tasks/main.yml
@@ -1,32 +1,44 @@
---
-- name: Create Sonarr Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ sonarr_data_directory }}"
+- name: Start Sonarr
+ block:
+ - name: Create Sonarr Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ sonarr_data_directory }}"
-- name: Sonarr
- docker_container:
- name: sonarr
- image: linuxserver/sonarr
- pull: true
- volumes:
- - "{{ sonarr_tv_directory }}:/tv:rw"
- - "{{ sonarr_download_directory }}:/downloads:rw"
- - "{{ sonarr_data_directory }}:/config:rw"
- ports:
- - "{{ sonarr_port }}:8989"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ sonarr_user_id }}"
- PGID: "{{ sonarr_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ sonarr_memory }}"
- labels:
- traefik.enable: "{{ sonarr_available_externally | string }}"
- traefik.http.routers.sonarr.rule: "Host(`{{ sonarr_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.sonarr.tls.certresolver: "letsencrypt"
- traefik.http.routers.sonarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.sonarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.sonarr.loadbalancer.server.port: "8989"
+ - name: Sonarr
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ sonarr_container_name }}"
+ image: "{{ sonarr_image_name }}:{{ sonarr_image_version }}"
+ pull: true
+ volumes:
+ - "{{ sonarr_tv_directory }}:/tv:rw"
+ - "{{ sonarr_download_directory }}:/downloads:rw"
+ - "{{ sonarr_data_directory }}:/config:rw"
+ ports:
+ - "{{ sonarr_port }}:8989"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ sonarr_user_id }}"
+ PGID: "{{ sonarr_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ sonarr_memory }}"
+ labels:
+ traefik.enable: "{{ sonarr_available_externally | string }}"
+ traefik.http.routers.sonarr.rule: "Host(`{{ sonarr_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.sonarr.tls.certresolver: "letsencrypt"
+ traefik.http.routers.sonarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.sonarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.sonarr.loadbalancer.server.port: "8989"
+ when: sonarr_enabled is true
+
+- name: Stop Sonarr
+ block:
+ - name: Stop Sonarr
+ community.docker.docker_container:
+ name: "{{ sonarr_container_name }}"
+ state: absent
+ when: sonarr_enabled is false
diff --git a/roles/speedtest-tracker/defaults/main.yml b/roles/speedtest-tracker/defaults/main.yml
index 91505ca1..d0ad354f 100644
--- a/roles/speedtest-tracker/defaults/main.yml
+++ b/roles/speedtest-tracker/defaults/main.yml
@@ -3,7 +3,7 @@ speedtest_tracker_enabled: false
speedtest_tracker_available_externally: false
# directories
-speedtest_data_directory: "{{ docker_home }}/speedtest_tracker/"
+speedtest_data_directory: "{{ docker_home }}/speedtest_tracker"
# uid / gid
speedtest_tracker_user_id: "0"
@@ -13,5 +13,10 @@ speedtest_tracker_group_id: "0"
speedtest_tracker_port: "8765"
speedtest_tracker_hostname: "speedtest-tracker"
+# docker
+speedtest_container_name: "speedtest-tracker"
+speedtest_image_name: "henrywhitaker3/speedtest-tracker"
+speedtest_image_version: "latest"
+
# specs
speedtest_tracker_memory: 1g
diff --git a/roles/speedtest-tracker/molecule/default/molecule.yml b/roles/speedtest-tracker/molecule/default/molecule.yml
new file mode 100644
index 00000000..aeaa6821
--- /dev/null
+++ b/roles/speedtest-tracker/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ speedtest_enabled: true
diff --git a/roles/speedtest-tracker/molecule/default/side_effect.yml b/roles/speedtest-tracker/molecule/default/side_effect.yml
new file mode 100644
index 00000000..0a92588c
--- /dev/null
+++ b/roles/speedtest-tracker/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ speedtest_enabled: false
diff --git a/roles/speedtest-tracker/molecule/default/verify.yml b/roles/speedtest-tracker/molecule/default/verify.yml
new file mode 100644
index 00000000..a8faf3ec
--- /dev/null
+++ b/roles/speedtest-tracker/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get speedtest container state
+ community.docker.docker_container:
+ name: "{{ speedtest_container_name }}"
+ register: result
+
+ - name: Check if speedtest containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/speedtest-tracker/molecule/default/verify_stopped.yml b/roles/speedtest-tracker/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..8118ee41
--- /dev/null
+++ b/roles/speedtest-tracker/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove speedtest
+ community.docker.docker_container:
+ name: "{{ speedtest_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if speedtest is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/speedtest-tracker/tasks/main.yml b/roles/speedtest-tracker/tasks/main.yml
index e59920ad..bd1096a8 100644
--- a/roles/speedtest-tracker/tasks/main.yml
+++ b/roles/speedtest-tracker/tasks/main.yml
@@ -1,34 +1,48 @@
---
-- name: Speedtest-Tracker Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ speedtest_data_directory }}/config"
+- name: Start Speedtest-Tracker
+ block:
+ - name: Speedtest-Tracker Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ speedtest_data_directory }}/config"
-- name: Remove old Speedtest-Tracker Docker Container
- docker_container:
- name: speedtest_tracker
- state: absent
+ - name: Remove old Speedtest-Tracker Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ speedtest_container_name }}"
+ state: absent
+ tags: molecule-idempotence-notest
-- name: Speedtest-Tracker Docker Container
- docker_container:
- name: speedtest-tracker
- image: henrywhitaker3/speedtest-tracker:latest
- pull: true
- volumes:
- - "{{ speedtest_data_directory }}/config:/config:rw"
- ports:
- - "{{ speedtest_tracker_port }}:80"
- env:
- OOKLA_EULA_GDPR: "true"
- TZ: "{{ ansible_nas_timezone }}"
- restart_policy: unless-stopped
- memory: "1g"
- labels:
- traefik.enable: "{{ speedtest_tracker_available_externally | string }}"
- traefik.http.routers.speedtest_tracker.rule: "Host(`{{ speedtest_tracker_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.speedtest_tracker.tls.certresolver: "letsencrypt"
- traefik.http.routers.speedtest_tracker.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.speedtest_tracker.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.speedtest_tracker.loadbalancer.server.port: "80"
+ - name: Speedtest-Tracker Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ speedtest_container_name }}"
+ image: "{{ speedtest_image_name }}:{{ speedtest_image_version }}"
+ pull: true
+ volumes:
+ - "{{ speedtest_data_directory }}/config:/config:rw"
+ ports:
+ - "{{ speedtest_tracker_port }}:80"
+ env:
+ OOKLA_EULA_GDPR: "true"
+ TZ: "{{ ansible_nas_timezone }}"
+ restart_policy: unless-stopped
+ memory: "1g"
+ labels:
+ traefik.enable: "{{ speedtest_tracker_available_externally | string }}"
+ traefik.http.routers.speedtest_tracker.rule: "Host(`{{ speedtest_tracker_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.speedtest_tracker.tls.certresolver: "letsencrypt"
+ traefik.http.routers.speedtest_tracker.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.speedtest_tracker.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.speedtest_tracker.loadbalancer.server.port: "80"
+ when: speedtest_enabled is true
+
+- name: Stop Speedtest-Tracker
+ block:
+ - name: Stop Speedtest-Tracker
+ community.docker.docker_container:
+ name: "{{ speedtest_container_name }}"
+ state: absent
+ when: speedtest_enabled is false
diff --git a/roles/stats/defaults/main.yml b/roles/stats/defaults/main.yml
index 5b370dc5..3dc240df 100644
--- a/roles/stats/defaults/main.yml
+++ b/roles/stats/defaults/main.yml
@@ -21,6 +21,23 @@ stats_prometheus_hostname: "prometheus"
stats_grafana_port: "3000"
stats_grafana_hostname: "grafana"
+# docker:
+stats_grafana_container_name: "stats-grafana"
+stats_grafana_image_name: "grafana/grafana"
+stats_grafana_image_version: "latest"
+stats_prometheus_container_name: "stats-prometheus"
+stats_prometheus_image_name: "prom/prometheus"
+stats_prometheus_image_version: "latest"
+stats_telegraf_container_name: "stats-telegraf"
+stats_telegraf_image_name: "telegraf"
+stats_telegraf_image_version: "latest"
+stats_smartctl_container_name: "stats-smartctl"
+stats_smartctl_docker_image_name: "matusnovak/prometheus-smartctl"
+stats_smartctl_docker_image_version: "latest"
+stats_speedtest_container_name: "stats-speedtest"
+stats_speedtest_docker_image_name: "miguelndecarvalho/speedtest-exporter"
+stats_speedtest_docker_image_version: "latest"
+
# specs
stats_telegraf_memory: 1g
stats_prometheus_memory: 1g
diff --git a/roles/stats/molecule/default/molecule.yml b/roles/stats/molecule/default/molecule.yml
new file mode 100644
index 00000000..d253635e
--- /dev/null
+++ b/roles/stats/molecule/default/molecule.yml
@@ -0,0 +1,24 @@
+---
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:ro
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp:rw
+ privileged: true
+ pre_build_image: true
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ stats_enabled: true
+ stats_prometheus_enabled: true
+ stats_internet_speed_test_enabled: true
+ ansible_nas_hostname: "ansible-nas"
+ stats_grafana_data_directory: "/tmp/grafana/data"
+ stats_grafana_config_directory: "/tmp/grafana/config"
+ stats_prometheus_data_directory: "/tmp/prometheus/data"
+ stats_prometheus_config_directory: "/tmp/prometheus/config"
+ stats_telegraf_config_directory: "/tmp/telegraf/config"
+ stats_collection_interval: 15s
diff --git a/roles/stats/molecule/default/side_effect.yml b/roles/stats/molecule/default/side_effect.yml
new file mode 100644
index 00000000..887ccf16
--- /dev/null
+++ b/roles/stats/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ stats_enabled: false
diff --git a/roles/stats/molecule/default/verify.yml b/roles/stats/molecule/default/verify.yml
new file mode 100644
index 00000000..4b08158d
--- /dev/null
+++ b/roles/stats/molecule/default/verify.yml
@@ -0,0 +1,47 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get Grafana container state
+ docker_container_info:
+ name: "{{ stats_grafana_container_name }}"
+ register: result_grafana
+
+ - name: Get Prometheus container state
+ docker_container_info:
+ name: "{{ stats_prometheus_container_name }}"
+ register: result_prometheus
+
+ - name: Get Telegraf container state
+ docker_container_info:
+ name: "{{ stats_telegraf_container_name }}"
+ register: result_telegraf
+
+ - name: Get Smartctl container state
+ docker_container_info:
+ name: "{{ stats_smartctl_container_name }}"
+ register: result_smartctl
+
+ - name: Get Speedtest container state
+ docker_container_info:
+ name: "{{ stats_speedtest_container_name }}"
+ register: result_speedtest
+
+ - name: Check if stats docker containers are running
+ assert:
+ that:
+ - result_grafana.container['State']['Status'] == "running"
+ - result_grafana.container['State']['Restarting'] == false
+ - result_prometheus.container['State']['Status'] == "running"
+ - result_prometheus.container['State']['Restarting'] == false
+ - result_telegraf.container['State']['Status'] == "running"
+ - result_telegraf.container['State']['Restarting'] == false
+ - result_smartctl.container['State']['Status'] == "running"
+ - result_smartctl.container['State']['Restarting'] == false
+ - result_speedtest.container['State']['Status'] == "running"
+ - result_speedtest.container['State']['Restarting'] == false
diff --git a/roles/stats/molecule/default/verify_stopped.yml b/roles/stats/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..7e04cfdb
--- /dev/null
+++ b/roles/stats/molecule/default/verify_stopped.yml
@@ -0,0 +1,47 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove Grafana
+ docker_container:
+ name: "{{ stats_grafana_container_name }}"
+ state: absent
+ register: result_grafana
+
+ - name: Try and stop and remove Prometheus
+ docker_container:
+ name: "{{ stats_prometheus_container_name }}"
+ state: absent
+ register: result_prometheus
+
+ - name: Try and stop and remove Telegraf
+ docker_container:
+ name: "{{ stats_telegraf_container_name }}"
+ state: absent
+ register: result_telegraf
+
+ - name: Try and stop and remove Smartctl
+ docker_container:
+ name: "{{ stats_smartctl_container_name }}"
+ state: absent
+ register: result_smartctl
+
+ - name: Try and stop and remove Speedtest
+ docker_container:
+ name: "{{ stats_speedtest_container_name }}"
+ state: absent
+ register: result_speedtest
+
+ - name: Check if stats containers are stopped
+ assert:
+ that:
+ - not result_grafana.changed
+ - not result_prometheus.changed
+ - not result_telegraf.changed
+ - not result_smartctl.changed
+ - not result_speedtest.changed
diff --git a/roles/stats/tasks/exporters.yml b/roles/stats/tasks/exporters.yml
index 79965817..9e3a3313 100644
--- a/roles/stats/tasks/exporters.yml
+++ b/roles/stats/tasks/exporters.yml
@@ -1,22 +1,39 @@
---
-- name: Smartctl Exporter Docker Container
- docker_container:
- name: stats-smartctl
- image: matusnovak/prometheus-smartctl:latest
- pull: true
- privileged: true
- ports:
- - "{{ stats_prometheus_smartctl_port }}:9902"
- restart_policy: unless-stopped
- memory: "{{ stats_prometheus_smartctl_memory }}"
+- name: Start Exporters
+ block:
+ - name: Smartctl Exporter Docker Container
+ docker_container:
+ name: "{{ stats_smartctl_container_name }}"
+ image: "{{ stats_smartctl_docker_image_name }}:{{ stats_smartctl_docker_image_version }}"
+ container_default_behavior: no_defaults
+ pull: true
+ privileged: true
+ ports:
+ - "{{ stats_prometheus_smartctl_port }}:9902"
+ restart_policy: unless-stopped
+ memory: "{{ stats_prometheus_smartctl_memory }}"
-- name: Speedtest Exporter Docker Container
- docker_container:
- name: stats-speedtest
- image: miguelndecarvalho/speedtest-exporter
- pull: true
- ports:
- "{{ stats_speedtest_exporter_port }}:9798"
- restart_policy: unless-stopped
- memory: "{{ stats_speedtest_exporter_memory }}"
- when: stats_internet_speed_test_enabled
+ - name: Speedtest Exporter Docker Container
+ docker_container:
+ name: "{{ stats_speedtest_container_name }}"
+ image: "{{ stats_speedtest_docker_image_name }}:{{ stats_speedtest_docker_image_version }}"
+ container_default_behavior: no_defaults
+ pull: true
+ ports:
+ "{{ stats_speedtest_exporter_port }}:9798"
+ restart_policy: unless-stopped
+ memory: "{{ stats_speedtest_exporter_memory }}"
+ when: stats_internet_speed_test_enabled
+ when: stats_enabled is true
+
+- name: Stop Exporters
+ block:
+ - name: Stop Smartctl Exporter
+ docker_container:
+ name: "{{ stats_smartctl_container_name }}"
+ state: absent
+ - name: Stop Speedtest Exporter
+ docker_container:
+ name: "{{ stats_speedtest_container_name }}"
+ state: absent
+ when: stats_enabled is false
diff --git a/roles/stats/tasks/grafana.yml b/roles/stats/tasks/grafana.yml
index 78aab599..cb0a5492 100644
--- a/roles/stats/tasks/grafana.yml
+++ b/roles/stats/tasks/grafana.yml
@@ -1,52 +1,65 @@
---
-- name: Create Grafana Directories
- file:
- path: "{{ item }}"
- state: directory
- owner: "472"
- recurse: yes
- with_items:
- - "{{ stats_grafana_data_directory }}"
- - "{{ stats_grafana_config_directory }}"
- - "{{ stats_grafana_config_directory }}/dashboards"
- - "{{ stats_grafana_config_directory }}/provisioning/datasources"
- - "{{ stats_grafana_config_directory }}/provisioning/dashboards"
+- name: Start Grafana
+ block:
+ - name: Create Grafana Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ owner: "472"
+ recurse: yes
+ changed_when: false
+ with_items:
+ - "{{ stats_grafana_data_directory }}"
+ - "{{ stats_grafana_config_directory }}"
+ - "{{ stats_grafana_config_directory }}/dashboards"
+ - "{{ stats_grafana_config_directory }}/provisioning/datasources"
+ - "{{ stats_grafana_config_directory }}/provisioning/dashboards"
-- name: Template Grafana data source
- template:
- src: datasources/ansible-nas.yml
- dest: "{{ stats_grafana_config_directory }}/provisioning/datasources/ansible-nas.yml"
+ - name: Template Grafana data source
+ ansible.builtin.template:
+ src: datasources/ansible-nas.yml
+ dest: "{{ stats_grafana_config_directory }}/provisioning/datasources/ansible-nas.yml"
-- name: Copy Grafana dashboards configuration
- copy:
- src: dashboards/ansible-nas.yml
- dest: "{{ stats_grafana_config_directory }}/provisioning/dashboards/ansible-nas.yml"
+ - name: Copy Grafana dashboards configuration
+ ansible.builtin.copy:
+ src: dashboards/ansible-nas.yml
+ dest: "{{ stats_grafana_config_directory }}/provisioning/dashboards/ansible-nas.yml"
-- name: Copy Grafana Ansible-NAS dashboard
- copy:
- src: dashboards/ansible-nas-overview.json
- dest: "{{ stats_grafana_config_directory }}/dashboards/ansible-nas-overview.json"
+ - name: Copy Grafana Ansible-NAS dashboard
+ ansible.builtin.copy:
+ src: dashboards/ansible-nas-overview.json
+ dest: "{{ stats_grafana_config_directory }}/dashboards/ansible-nas-overview.json"
-- name: Grafana Docker Container
- docker_container:
- name: grafana
- image: grafana/grafana
- pull: true
- volumes:
- - "{{ stats_grafana_data_directory }}:/var/lib/grafana:rw"
- - "{{ stats_grafana_config_directory }}/provisioning:/etc/grafana/provisioning:ro"
- - "{{ stats_grafana_config_directory }}/dashboards:/etc/dashboards:ro"
- ports:
- - "{{ stats_grafana_port }}:3000"
- env:
- GF_PLUGINS_ENABLE_ALPHA: "true"
- GF_UNIFIED_ALERTING_ENABLED: "true"
- restart_policy: unless-stopped
- memory: 1g
- labels:
- traefik.enable: "{{ stats_grafana_available_externally | string }}"
- traefik.http.routers.grafana.rule: "Host(`grafana.{{ ansible_nas_domain }}`) "
- traefik.http.routers.grafana.tls.certresolver: "letsencrypt"
- traefik.http.routers.grafana.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.grafana.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.grafana.loadbalancer.server.port: "3000"
+ - name: Grafana Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ stats_grafana_container_name }}"
+ image: "{{ stats_grafana_image_name }}:{{ stats_grafana_image_version }}"
+ pull: true
+ volumes:
+ - "{{ stats_grafana_data_directory }}:/var/lib/grafana:rw"
+ - "{{ stats_grafana_config_directory }}/provisioning:/etc/grafana/provisioning:ro"
+ - "{{ stats_grafana_config_directory }}/dashboards:/etc/dashboards:ro"
+ ports:
+ - "{{ stats_grafana_port }}:3000"
+ env:
+ GF_PLUGINS_ENABLE_ALPHA: "true"
+ GF_UNIFIED_ALERTING_ENABLED: "true"
+ restart_policy: unless-stopped
+ memory: 1g
+ labels:
+ traefik.enable: "{{ stats_grafana_available_externally | string }}"
+ traefik.http.routers.grafana.rule: "Host(`grafana.{{ ansible_nas_domain }}`) "
+ traefik.http.routers.grafana.tls.certresolver: "letsencrypt"
+ traefik.http.routers.grafana.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.grafana.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.grafana.loadbalancer.server.port: "3000"
+ when: stats_enabled is true
+
+- name: Stop Grafana
+ block:
+ - name: Stop Grafana
+ community.docker.docker_container:
+ name: "{{ stats_grafana_container_name }}"
+ state: absent
+ when: stats_enabled is false
diff --git a/roles/stats/tasks/prometheus.yml b/roles/stats/tasks/prometheus.yml
index fa2779be..daf69078 100644
--- a/roles/stats/tasks/prometheus.yml
+++ b/roles/stats/tasks/prometheus.yml
@@ -1,46 +1,58 @@
---
-- name: Create Prometheus Config Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ stats_prometheus_data_directory }}"
- - "{{ stats_prometheus_config_directory }}"
+- name: Start Prometheus
+ block:
+ - name: Create Prometheus Config Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ stats_prometheus_data_directory }}"
+ - "{{ stats_prometheus_config_directory }}"
-- name: Create Prometheus Data Directory
- file:
- path: "{{ item }}"
- state: directory
- mode: 0777
- with_items:
- - "{{ stats_prometheus_data_directory }}"
- - "{{ stats_prometheus_config_directory }}"
+ - name: Create Prometheus Data Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ mode: 0777
+ with_items:
+ - "{{ stats_prometheus_data_directory }}"
+ - "{{ stats_prometheus_config_directory }}"
-- name: Template Prometheus config
- template:
- src: prometheus.yml.j2
- dest: "{{ stats_prometheus_config_directory }}/prometheus.yml"
- register: prometheus_config
+ - name: Template Prometheus config
+ ansible.builtin.template:
+ src: prometheus.yml.j2
+ dest: "{{ stats_prometheus_config_directory }}/prometheus.yml"
+ register: prometheus_config
-- name: Prometheus Docker Container
- docker_container:
- name: stats-prometheus
- image: prom/prometheus
- pull: true
- volumes:
- - "{{ stats_prometheus_config_directory }}/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
- - "{{ stats_prometheus_data_directory }}:/prometheus:rw"
- - "/etc/timezone:/etc/timezone:ro"
- ports:
- - "{{ stats_prometheus_port }}:9090"
- restart_policy: unless-stopped
- memory: "{{ stats_prometheus_memory }}"
- restart: "{{ prometheus_config is changed }}"
- command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention.size={{ stats_prometheus_retention_size }} --storage.tsdb.retention.time={{ stats_prometheus_retention_time }}"
- labels:
- traefik.enable: "{{ stats_prometheus_available_externally | string }}"
- traefik.http.routers.prometheus.rule: "Host(`{{ stats_prometheus_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.prometheus.tls.certresolver: "letsencrypt"
- traefik.http.routers.prometheus.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.prometheus.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.prometheus.loadbalancer.server.port: "9090"
+ - name: Prometheus Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ stats_prometheus_container_name }}"
+ image: "{{ stats_prometheus_image_name }}:{{ stats_prometheus_image_version }}"
+ pull: true
+ volumes:
+ - "{{ stats_prometheus_config_directory }}/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
+ - "{{ stats_prometheus_data_directory }}:/prometheus:rw"
+ - "/etc/timezone:/etc/timezone:ro"
+ ports:
+ - "{{ stats_prometheus_port }}:9090"
+ restart_policy: unless-stopped
+ memory: "{{ stats_prometheus_memory }}"
+ restart: "{{ prometheus_config is changed }}"
+ command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention.size={{ stats_prometheus_retention_size }} --storage.tsdb.retention.time={{ stats_prometheus_retention_time }}"
+ labels:
+ traefik.enable: "{{ stats_prometheus_available_externally | string }}"
+ traefik.http.routers.prometheus.rule: "Host(`{{ stats_prometheus_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.prometheus.tls.certresolver: "letsencrypt"
+ traefik.http.routers.prometheus.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.prometheus.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.prometheus.loadbalancer.server.port: "9090"
+ when: stats_enabled is true
+
+- name: Stop Prometheus
+ block:
+ - name: Stop Prometheus
+ community.docker.docker_container:
+ name: "{{ stats_prometheus_container_name }}"
+ state: absent
+ when: stats_enabled is false
diff --git a/roles/stats/tasks/telegraf.yml b/roles/stats/tasks/telegraf.yml
index 0f087957..7d0bc716 100644
--- a/roles/stats/tasks/telegraf.yml
+++ b/roles/stats/tasks/telegraf.yml
@@ -1,49 +1,61 @@
---
-- name: Create Telegraf Directory
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ stats_telegraf_config_directory }}"
+- name: Start Telegraf
+ block:
+ - name: Create Telegraf Directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ stats_telegraf_config_directory }}"
-- name: Template telegraf.conf
- template:
- src: telegraf.conf.j2
- dest: "{{ stats_telegraf_config_directory }}/telegraf.conf"
- register: telegraf_config
+ - name: Template telegraf.conf
+ ansible.builtin.template:
+ src: telegraf.conf.j2
+ dest: "{{ stats_telegraf_config_directory }}/telegraf.conf"
+ register: telegraf_config
-- name: Get Docker daemon uid
- command: stat -c '%g' /var/run/docker.sock
- register: docker_uid
- changed_when: false
+ - name: Get Docker daemon uid
+ ansible.builtin.command: stat -c '%g' /var/run/docker.sock
+ register: docker_uid
+ changed_when: false
-- name: Telegraf Docker Container
- docker_container:
- name: stats-telegraf
- image: telegraf
- pull: true
- privileged: true
- ipc_mode: host
- ports:
- - "{{ stats_telegraf_influxdb_port }}:8086"
- - "{{ stats_telegraf_port }}:9273"
- user: "telegraf:{{ docker_uid.stdout }}"
- volumes:
- - "{{ stats_telegraf_config_directory }}/telegraf.conf:/etc/telegraf/telegraf.conf:ro"
- - "/var/run/docker.sock:/var/run/docker.sock:ro"
- - "/:/hostfs:ro"
- - "/etc:/hostfs/etc:ro"
- - "/proc:/hostfs/proc:ro"
- - "/sys:/hostfs/sys:ro"
- - "/var:/hostfs/var:ro"
- - "/run:/hostfs/run:ro"
- env:
- HOST_ETC: "/hostfs/etc"
- HOST_PROC: "/hostfs/proc"
- HOST_SYS: "/hostfs/sys"
- HOST_VAR: "/hostfs/var"
- HOST_RUN: "/hostfs/run"
- HOST_MOUNT_PREFIX: "/hostfs"
- restart_policy: unless-stopped
- memory: 1g
- restart: "{{ telegraf_config is changed }}"
+ - name: Telegraf Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ stats_telegraf_container_name }}"
+ image: "{{ stats_telegraf_image_name }}:{{ stats_telegraf_image_version }}"
+ pull: true
+ privileged: true
+ ipc_mode: host
+ ports:
+ - "{{ stats_telegraf_influxdb_port }}:8086"
+ - "{{ stats_telegraf_port }}:9273"
+ user: "telegraf:{{ docker_uid.stdout }}"
+ volumes:
+ - "{{ stats_telegraf_config_directory }}:/etc/telegraf/:ro"
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
+ - "/:/hostfs:ro"
+ - "/etc:/hostfs/etc:ro"
+ - "/proc:/hostfs/proc:ro"
+ - "/sys:/hostfs/sys:ro"
+ - "/var:/hostfs/var:ro"
+ - "/run:/hostfs/run:ro"
+ env:
+ HOST_ETC: "/hostfs/etc"
+ HOST_PROC: "/hostfs/proc"
+ HOST_SYS: "/hostfs/sys"
+ HOST_VAR: "/hostfs/var"
+ HOST_RUN: "/hostfs/run"
+ HOST_MOUNT_PREFIX: "/hostfs"
+ restart_policy: unless-stopped
+ memory: 1g
+ restart: "{{ telegraf_config is changed }}"
+ when: stats_enabled is true
+
+- name: Stop Telegraf
+ block:
+ - name: Stop stats_telegraf
+ community.docker.docker_container:
+ name: "{{ stats_telegraf_container_name }}"
+ state: absent
+ when: stats_enabled is false
diff --git a/roles/syncthing/defaults/main.yml b/roles/syncthing/defaults/main.yml
index 1d139a0c..de977b96 100644
--- a/roles/syncthing/defaults/main.yml
+++ b/roles/syncthing/defaults/main.yml
@@ -19,5 +19,10 @@ syncthing_group_id: "0"
syncthing_port: 8384
syncthing_hostname: syncthing
+# docker
+syncthing_container_name: "syncthing"
+syncthing_image_name: "syncthing/syncthing"
+syncthing_image_version: "latest"
+
# specs
syncthing_memory: 1g
diff --git a/roles/syncthing/molecule/default/molecule.yml b/roles/syncthing/molecule/default/molecule.yml
new file mode 100644
index 00000000..488a27b0
--- /dev/null
+++ b/roles/syncthing/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ syncthing_enabled: true
diff --git a/roles/syncthing/molecule/default/side_effect.yml b/roles/syncthing/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f34fce7e
--- /dev/null
+++ b/roles/syncthing/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ syncthing_enabled: false
diff --git a/roles/syncthing/molecule/default/verify.yml b/roles/syncthing/molecule/default/verify.yml
new file mode 100644
index 00000000..09439f5d
--- /dev/null
+++ b/roles/syncthing/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get syncthing container state
+ community.docker.docker_container:
+ name: "{{ syncthing_container_name }}"
+ register: result
+
+ - name: Check if syncthing containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/syncthing/molecule/default/verify_stopped.yml b/roles/syncthing/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..e7511873
--- /dev/null
+++ b/roles/syncthing/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove syncthing
+ community.docker.docker_container:
+ name: "{{ syncthing_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if syncthing is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/syncthing/tasks/main.yml b/roles/syncthing/tasks/main.yml
index da7f69fa..b3ce9c6c 100644
--- a/roles/syncthing/tasks/main.yml
+++ b/roles/syncthing/tasks/main.yml
@@ -1,30 +1,42 @@
---
-- name: Create Syncthing Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ syncthing_data_directory }}"
+- name: Start Syncthing
+ block:
+ - name: Create Syncthing Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ syncthing_data_directory }}"
-- name: Syncthing Docker Container
- docker_container:
- name: syncthing
- image: syncthing/syncthing:latest
- pull: true
- ports:
- - "{{ syncthing_port }}:8384"
- - "22000:22000/tcp"
- - "22000:22000/udp"
- env:
- PUID: "{{ syncthing_user_id }}"
- PGID: "{{ syncthing_group_id }}"
- volumes: "{{ syncthing_volumes }}"
- restart_policy: unless-stopped
- memory: "{{ syncthing_memory }}"
- labels:
- traefik.enable: "{{ syncthing_available_externally | string }}"
- traefik.http.routers.syncthing.rule: "Host(`{{ syncthing_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.syncthing.tls.certresolver: "letsencrypt"
- traefik.http.routers.syncthing.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.syncthing.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.syncthing.loadbalancer.server.port: "8384"
+ - name: Syncthing Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ syncthing_container_name }}"
+ image: "{{ syncthing_image_name }}:{{ syncthing_image_version }}"
+ pull: true
+ ports:
+ - "{{ syncthing_port }}:8384"
+ - "22000:22000/tcp"
+ - "22000:22000/udp"
+ env:
+ PUID: "{{ syncthing_user_id }}"
+ PGID: "{{ syncthing_group_id }}"
+ volumes: "{{ syncthing_volumes }}"
+ restart_policy: unless-stopped
+ memory: "{{ syncthing_memory }}"
+ labels:
+ traefik.enable: "{{ syncthing_available_externally | string }}"
+ traefik.http.routers.syncthing.rule: "Host(`{{ syncthing_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.syncthing.tls.certresolver: "letsencrypt"
+ traefik.http.routers.syncthing.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.syncthing.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.syncthing.loadbalancer.server.port: "8384"
+ when: syncthing_enabled is true
+
+- name: Stop Syncthing
+ block:
+ - name: Stop Syncthing
+ community.docker.docker_container:
+ name: "{{ syncthing_container_name }}"
+ state: absent
+ when: syncthing_enabled is false
diff --git a/roles/tautulli/defaults/main.yml b/roles/tautulli/defaults/main.yml
index b908d1be..35ab1ac0 100644
--- a/roles/tautulli/defaults/main.yml
+++ b/roles/tautulli/defaults/main.yml
@@ -13,5 +13,10 @@ tautulli_group_id: "0"
tautulli_hostname: "tautulli"
tautulli_port: "8185"
+# docker
+tautulli_container_name: "tautulli"
+tautulli_image_name: "linuxserver/tautulli"
+tautulli_image_version: "latest"
+
# specs
tautulli_memory: "1g"
diff --git a/roles/tautulli/molecule/default/molecule.yml b/roles/tautulli/molecule/default/molecule.yml
new file mode 100644
index 00000000..e21b67ba
--- /dev/null
+++ b/roles/tautulli/molecule/default/molecule.yml
@@ -0,0 +1,7 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ tautulli_enabled: true
+ plex_logs: "/tmp/log"
diff --git a/roles/tautulli/molecule/default/side_effect.yml b/roles/tautulli/molecule/default/side_effect.yml
new file mode 100644
index 00000000..5d26b19a
--- /dev/null
+++ b/roles/tautulli/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ tautulli_enabled: false
diff --git a/roles/tautulli/molecule/default/verify.yml b/roles/tautulli/molecule/default/verify.yml
new file mode 100644
index 00000000..7fe57d05
--- /dev/null
+++ b/roles/tautulli/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get tautulli container state
+ community.docker.docker_container:
+ name: "{{ tautulli_container_name }}"
+ register: result
+
+ - name: Check if tautulli containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/tautulli/molecule/default/verify_stopped.yml b/roles/tautulli/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..c47aaab9
--- /dev/null
+++ b/roles/tautulli/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove tautulli
+ community.docker.docker_container:
+ name: "{{ tautulli_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if tautulli is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/tautulli/tasks/main.yml b/roles/tautulli/tasks/main.yml
index ae986bcf..66e293f0 100644
--- a/roles/tautulli/tasks/main.yml
+++ b/roles/tautulli/tasks/main.yml
@@ -1,33 +1,45 @@
---
-- name: Create Tautulli Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ tautulli_config_directory }}"
- - "{{ plex_logs }}"
+- name: Start Tautulli
+ block:
+ - name: Create Tautulli Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ tautulli_config_directory }}"
+ - "{{ plex_logs }}"
-- name: Tautulli Docker Container
- docker_container:
- name: tautulli
- image: linuxserver/tautulli
- pull: true
- volumes:
- - "{{ tautulli_config_directory }}:/config:rw"
- - "{{ plex_logs }}:/logs:ro"
- ports:
- - "{{ tautulli_port }}:8181"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ tautulli_user_id }}"
- PGID: "{{ tautulli_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ tautulli_memory }}"
- labels:
- traefik.enable: "{{ tautulli_available_externally | string }}"
- traefik.http.routers.tautulli.rule: "Host(`{{ tautulli_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.tautulli.tls.certresolver: "letsencrypt"
- traefik.http.routers.tautulli.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.tautulli.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.tautulli.loadbalancer.server.port: "8181"
+ - name: Tautulli Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ tautulli_container_name }}"
+ image: "{{ tautulli_image_name }}:{{ tautulli_image_version }}"
+ pull: true
+ volumes:
+ - "{{ tautulli_config_directory }}:/config:rw"
+ - "{{ plex_logs }}:/logs:ro"
+ ports:
+ - "{{ tautulli_port }}:8181"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ tautulli_user_id }}"
+ PGID: "{{ tautulli_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ tautulli_memory }}"
+ labels:
+ traefik.enable: "{{ tautulli_available_externally | string }}"
+ traefik.http.routers.tautulli.rule: "Host(`{{ tautulli_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.tautulli.tls.certresolver: "letsencrypt"
+ traefik.http.routers.tautulli.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.tautulli.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.tautulli.loadbalancer.server.port: "8181"
+ when: tautulli_enabled is true
+
+- name: Stop Tautulli
+ block:
+ - name: Stop Tautulli
+ community.docker.docker_container:
+ name: "{{ tautulli_container_name }}"
+ state: absent
+ when: tautulli_enabled is false
diff --git a/roles/thelounge/defaults/main.yml b/roles/thelounge/defaults/main.yml
index 96b91dbf..50b74fe7 100644
--- a/roles/thelounge/defaults/main.yml
+++ b/roles/thelounge/defaults/main.yml
@@ -12,3 +12,6 @@ thelounge_hostname: thelounge
# Container
thelounge_memory: 1g
+thelounge_container_name: "thelounge"
+thelounge_image_name: "thelounge/thelounge"
+thelounge_image_version: "latest"
diff --git a/roles/thelounge/molecule/default/molecule.yml b/roles/thelounge/molecule/default/molecule.yml
new file mode 100644
index 00000000..417212a1
--- /dev/null
+++ b/roles/thelounge/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ thelounge_enabled: true
diff --git a/roles/thelounge/molecule/default/side_effect.yml b/roles/thelounge/molecule/default/side_effect.yml
new file mode 100644
index 00000000..7aa48bcc
--- /dev/null
+++ b/roles/thelounge/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ thelounge_enabled: false
diff --git a/roles/thelounge/molecule/default/verify.yml b/roles/thelounge/molecule/default/verify.yml
new file mode 100644
index 00000000..ad0b83cc
--- /dev/null
+++ b/roles/thelounge/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get thelounge container state
+ community.docker.docker_container:
+ name: "{{ thelounge_container_name }}"
+ register: result
+
+ - name: Check if thelounge containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/thelounge/molecule/default/verify_stopped.yml b/roles/thelounge/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..8dbdaa1d
--- /dev/null
+++ b/roles/thelounge/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove thelounge
+ community.docker.docker_container:
+ name: "{{ thelounge_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if thelounge is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/thelounge/tasks/main.yml b/roles/thelounge/tasks/main.yml
index b7cd3d05..3f32a4b9 100644
--- a/roles/thelounge/tasks/main.yml
+++ b/roles/thelounge/tasks/main.yml
@@ -1,35 +1,47 @@
---
-- name: The Lounge Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ thelounge_data_directory }}"
- - "{{ thelounge_data_directory }}/users"
+- name: Start The Lounge
+ block:
+ - name: The Lounge Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ thelounge_data_directory }}"
+ - "{{ thelounge_data_directory }}/users"
-- name: Set up admin user
- copy:
- src: admin.json
- dest: "{{ thelounge_data_directory }}/users/admin.json"
- mode: 0777
+ - name: Set up admin user
+ ansible.builtin.copy:
+ src: admin.json
+ dest: "{{ thelounge_data_directory }}/users/admin.json"
+ mode: 0777
-- name: The Lounge Docker Container
- docker_container:
- name: thelounge
- image: thelounge/thelounge:latest
- pull: true
- ports:
- - "{{ thelounge_port_one }}:9001"
- - "{{ thelounge_port_two }}:9000"
- volumes:
- - "{{ thelounge_data_directory }}:/var/opt/thelounge"
- - "/var/run/dbus:/var/run/dbus"
- restart_policy: unless-stopped
- memory: "{{ thelounge_memory }}"
- labels:
- traefik.enable: "{{ thelounge_available_externally | string }}"
- traefik.http.routers.thelounge.rule: "Host(`{{ thelounge_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.thelounge.tls.certresolver: "letsencrypt"
- traefik.http.routers.thelounge.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.thelounge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.thelounge.loadbalancer.server.port: "9000"
+ - name: The Lounge Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ thelounge_container_name }}"
+ image: "{{ thelounge_image_name }}:{{ thelounge_image_version }}"
+ pull: true
+ ports:
+ - "{{ thelounge_port_one }}:9001"
+ - "{{ thelounge_port_two }}:9000"
+ volumes:
+ - "{{ thelounge_data_directory }}:/var/opt/thelounge"
+ - "/var/run/dbus:/var/run/dbus"
+ restart_policy: unless-stopped
+ memory: "{{ thelounge_memory }}"
+ labels:
+ traefik.enable: "{{ thelounge_available_externally | string }}"
+ traefik.http.routers.thelounge.rule: "Host(`{{ thelounge_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.thelounge.tls.certresolver: "letsencrypt"
+ traefik.http.routers.thelounge.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.thelounge.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.thelounge.loadbalancer.server.port: "9000"
+ when: thelounge_enabled is true
+
+- name: Stop The Lounge
+ block:
+ - name: Stop The Lounge
+ community.docker.docker_container:
+ name: "{{ thelounge_container_name }}"
+ state: absent
+ when: thelounge_enabled is false
diff --git a/roles/tiddlywiki/defaults/main.yml b/roles/tiddlywiki/defaults/main.yml
index 9b4b69f1..c5ef7468 100644
--- a/roles/tiddlywiki/defaults/main.yml
+++ b/roles/tiddlywiki/defaults/main.yml
@@ -21,3 +21,6 @@ tiddlywiki_hostname: tiddlywiki
# Container
tiddlywiki_memory: 512MB
+tiddlywiki_container_name: "tiddlywiki"
+tiddlywiki_image_name: "wmudge/tiddlywiki"
+tiddlywiki_image_version: "latest"
diff --git a/roles/tiddlywiki/molecule/default/molecule.yml b/roles/tiddlywiki/molecule/default/molecule.yml
new file mode 100644
index 00000000..42fbe1c5
--- /dev/null
+++ b/roles/tiddlywiki/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ tiddlywiki_enabled: true
diff --git a/roles/tiddlywiki/molecule/default/side_effect.yml b/roles/tiddlywiki/molecule/default/side_effect.yml
new file mode 100644
index 00000000..78c74abf
--- /dev/null
+++ b/roles/tiddlywiki/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ tiddlywiki_enabled: false
diff --git a/roles/tiddlywiki/molecule/default/verify.yml b/roles/tiddlywiki/molecule/default/verify.yml
new file mode 100644
index 00000000..cefc8177
--- /dev/null
+++ b/roles/tiddlywiki/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get tiddlywiki container state
+ community.docker.docker_container:
+ name: "{{ tiddlywiki_container_name }}"
+ register: result
+
+ - name: Check if tiddlywiki containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/tiddlywiki/molecule/default/verify_stopped.yml b/roles/tiddlywiki/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..debf551c
--- /dev/null
+++ b/roles/tiddlywiki/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove tiddlywiki
+ community.docker.docker_container:
+ name: "{{ tiddlywiki_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if tiddlywiki is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/tiddlywiki/tasks/main.yml b/roles/tiddlywiki/tasks/main.yml
index 220d1f22..4be056a5 100644
--- a/roles/tiddlywiki/tasks/main.yml
+++ b/roles/tiddlywiki/tasks/main.yml
@@ -1,29 +1,41 @@
---
-- name: Create Tiddlywiki Directory
- file:
- path: "{{ tiddlywiki_data_directory }}"
- state: directory
+- name: Start Tiddlywiki
+ block:
+ - name: Create Tiddlywiki Directory
+ ansible.builtin.file:
+ path: "{{ tiddlywiki_data_directory }}"
+ state: directory
-- name: Create Tiddlywiki Container
- docker_container:
- name: tiddlywiki
- image: wmudge/tiddlywiki:latest
- ports:
- - "{{ tiddlywiki_port }}:8080"
- volumes:
- - "{{ tiddlywiki_data_directory }}:/var/lib/tiddlywiki"
- env:
- NODE_MEM: "{{ tiddlywiki_node_memory | default(omit) }}"
- USERNAME: "{{ tiddlywiki_username | default(omit) }}"
- PASSWORD: "{{ tiddlywiki_password | default(omit) }}"
- DEBUG: "{{ tiddlywiki_debug_level | default(omit) }}"
- pull: true
- restart_policy: unless-stopped
- memory: "{{ tiddlywiki_memory }}"
- labels:
- traefik.enable: "{{ tiddlywiki_available_externally | string }}"
- traefik.http.routers.tiddlywiki.rule: "Host(`{{ tiddlywiki_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.tiddlywiki.tls.certresolver: "letsencrypt"
- traefik.http.routers.tiddlywiki.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.tiddlywiki.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.tiddlywiki.loadbalancer.server.port: "8080"
+ - name: Create Tiddlywiki Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ tiddlywiki_container_name }}"
+ image: "{{ tiddlywiki_image_name }}:{{ tiddlywiki_image_version }}"
+ ports:
+ - "{{ tiddlywiki_port }}:8080"
+ volumes:
+ - "{{ tiddlywiki_data_directory }}:/var/lib/tiddlywiki"
+ env:
+ NODE_MEM: "{{ tiddlywiki_node_memory | default(omit) }}"
+ USERNAME: "{{ tiddlywiki_username | default(omit) }}"
+ PASSWORD: "{{ tiddlywiki_password | default(omit) }}"
+ DEBUG: "{{ tiddlywiki_debug_level | default(omit) }}"
+ pull: true
+ restart_policy: unless-stopped
+ memory: "{{ tiddlywiki_memory }}"
+ labels:
+ traefik.enable: "{{ tiddlywiki_available_externally | string }}"
+ traefik.http.routers.tiddlywiki.rule: "Host(`{{ tiddlywiki_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.tiddlywiki.tls.certresolver: "letsencrypt"
+ traefik.http.routers.tiddlywiki.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.tiddlywiki.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.tiddlywiki.loadbalancer.server.port: "8080"
+ when: tiddlywiki_enabled is true
+
+- name: Stop Tiddlywiki
+ block:
+ - name: Stop Tiddlywiki
+ community.docker.docker_container:
+ name: "{{ tiddlywiki_container_name }}"
+ state: absent
+ when: tiddlywiki_enabled is false
diff --git a/roles/timemachine/defaults/main.yml b/roles/timemachine/defaults/main.yml
index 9c26bf4c..87abd6fb 100644
--- a/roles/timemachine/defaults/main.yml
+++ b/roles/timemachine/defaults/main.yml
@@ -14,3 +14,6 @@ timemachine_port: "10445"
# Container
timemachine_memory: 1g
+timemachine_container_name: "timemachine"
+timemachine_image_name: "awlnx/samba-timemachine"
+timemachine_image_version: "latest"
diff --git a/roles/timemachine/handlers/main.yml b/roles/timemachine/handlers/main.yml
new file mode 100644
index 00000000..4e1a1ff1
--- /dev/null
+++ b/roles/timemachine/handlers/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Reload Avahi Configuration
+ ansible.builtin.service:
+ name: avahi-daemon
+ state: reloaded
+ listen: "reload avahi configuration"
diff --git a/roles/timemachine/molecule/default/molecule.yml b/roles/timemachine/molecule/default/molecule.yml
new file mode 100644
index 00000000..4beec808
--- /dev/null
+++ b/roles/timemachine/molecule/default/molecule.yml
@@ -0,0 +1,16 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ timemachine_enabled: true
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ cgroupns_mode: host
+ command: "/usr/sbin/init"
+ privileged: true
+ pre_build_image: true
diff --git a/roles/timemachine/molecule/default/side_effect.yml b/roles/timemachine/molecule/default/side_effect.yml
new file mode 100644
index 00000000..d98cda62
--- /dev/null
+++ b/roles/timemachine/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ timemachine_enabled: false
diff --git a/roles/timemachine/molecule/default/verify.yml b/roles/timemachine/molecule/default/verify.yml
new file mode 100644
index 00000000..ff6c0265
--- /dev/null
+++ b/roles/timemachine/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get timemachine container state
+ community.docker.docker_container:
+ name: "{{ timemachine_container_name }}"
+ register: result
+
+ - name: Check if timemachine containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/timemachine/molecule/default/verify_stopped.yml b/roles/timemachine/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..e916db5f
--- /dev/null
+++ b/roles/timemachine/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove timemachine
+ community.docker.docker_container:
+ name: "{{ timemachine_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if timemachine is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/timemachine/tasks/main.yml b/roles/timemachine/tasks/main.yml
index 284ceb62..a05bd01f 100644
--- a/roles/timemachine/tasks/main.yml
+++ b/roles/timemachine/tasks/main.yml
@@ -1,41 +1,50 @@
---
-- name: Time Machine Directories
- file:
- path: "{{ timemachine_data_directory }}"
- state: directory
+- name: Start Time Machine
+ block:
+ - name: Time Machine Directories
+ ansible.builtin.file:
+ path: "{{ timemachine_data_directory }}"
+ state: directory
-- name: Time Machine Docker Container
- docker_container:
- name: timemachine
- image: awlnx/samba-timemachine:latest
- pull: true
- ports:
- - "{{ timemachine_port }}:445"
- env:
- TMSIZE: "{{ timemachine_volume_size_limit }}"
- PASS: "{{ timemachine_password }}"
- SHARENAME: "{{ timemachine_share_name }}"
- volumes:
- - "{{ timemachine_data_directory }}/data:/backups"
- ulimits:
- - "nofile:1048576:1048576"
- network_mode: bridge
- restart_policy: unless-stopped
- memory: "{{ timemachine_memory }}"
+ - name: Time Machine Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ timemachine_container_name }}"
+ image: "{{ timemachine_image_name }}:{{ timemachine_image_version }}"
+ pull: true
+ ports:
+ - "{{ timemachine_port }}:445"
+ env:
+ TMSIZE: "{{ timemachine_volume_size_limit }}"
+ PASS: "{{ timemachine_password }}"
+ SHARENAME: "{{ timemachine_share_name }}"
+ volumes:
+ - "{{ timemachine_data_directory }}/data:/backups"
+ ulimits:
+ - "nofile:1048576:1048576"
+ network_mode: bridge
+ restart_policy: unless-stopped
+ memory: "{{ timemachine_memory }}"
-- name: Install avahi
- apt:
- name: "avahi-daemon"
- state: present
- register: result
- until: result is succeeded
+ - name: Install avahi
+ ansible.builtin.apt:
+ name: "avahi-daemon"
+ state: present
+ update_cache: yes
+ register: result
+ until: result is succeeded
-- name: Setup timemachine service for avahi
- template:
- src: timemachine.service
- dest: "/etc/avahi/services/timemachine.service"
+ - name: Setup timemachine service for avahi
+ ansible.builtin.template:
+ src: timemachine.service
+ dest: "/etc/avahi/services/timemachine.service"
+ notify: reload avahi configuration
+ when: timemachine_enabled is true
-- name: Reload avahi configuration
- service:
- name: avahi-daemon
- state: reloaded
+- name: Stop Time Machine
+ block:
+ - name: Stop Time Machine
+ community.docker.docker_container:
+ name: "{{ timemachine_container_name }}"
+ state: absent
+ when: timemachine_enabled is false
diff --git a/roles/traefik/defaults/main.yml b/roles/traefik/defaults/main.yml
index a85fd4aa..63561dd8 100644
--- a/roles/traefik/defaults/main.yml
+++ b/roles/traefik/defaults/main.yml
@@ -14,7 +14,9 @@ traefik_port_http: "80"
traefik_port_https: "443"
traefik_port_ui: "8083"
-traefik_docker_image: traefik:latest
+traefik_container_name: "traefik"
+traefik_image_name: "traefik"
+traefik_image_version: "latest"
traefik_log_level: "INFO"
# find the relevant name and environment variables for your DNS provider at https://go-acme.github.io/lego/dns/
diff --git a/roles/traefik/molecule/default/molecule.yml b/roles/traefik/molecule/default/molecule.yml
new file mode 100644
index 00000000..9e1a5958
--- /dev/null
+++ b/roles/traefik/molecule/default/molecule.yml
@@ -0,0 +1,18 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ traefik_enabled: true
+ ansible_nas_email: me@example.com
+ traefik_data_directory: "/tmp/traefik"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp
+ cgroupns_mode: host
+ privileged: true
+ pre_build_image: true
diff --git a/roles/traefik/molecule/default/side_effect.yml b/roles/traefik/molecule/default/side_effect.yml
new file mode 100644
index 00000000..709ed0eb
--- /dev/null
+++ b/roles/traefik/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ traefik_enabled: false
diff --git a/roles/traefik/molecule/default/verify.yml b/roles/traefik/molecule/default/verify.yml
new file mode 100644
index 00000000..94510931
--- /dev/null
+++ b/roles/traefik/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get traefik container state
+ community.docker.docker_container:
+ name: "{{ traefik_container_name }}"
+ register: result
+
+ - name: Check if traefik containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/traefik/molecule/default/verify_stopped.yml b/roles/traefik/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..ab920550
--- /dev/null
+++ b/roles/traefik/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove traefik
+ community.docker.docker_container:
+ name: "{{ traefik_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if traefik is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/traefik/tasks/main.yml b/roles/traefik/tasks/main.yml
index 451112e4..bc06b97a 100644
--- a/roles/traefik/tasks/main.yml
+++ b/roles/traefik/tasks/main.yml
@@ -1,29 +1,41 @@
---
-- name: Create Traefik Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ traefik_data_directory }}"
- - "{{ traefik_data_directory }}/letsencrypt"
+- name: Start Traefik
+ block:
+ - name: Create Traefik Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ traefik_data_directory }}"
+ - "{{ traefik_data_directory }}/letsencrypt"
-- name: Template Traefik config.toml
- template:
- src: traefik.toml
- dest: "{{ traefik_data_directory }}/traefik.toml"
- register: template_config
+ - name: Template Traefik config.toml
+ ansible.builtin.template:
+ src: traefik.toml
+ dest: "{{ traefik_data_directory }}/traefik.toml"
+ register: template_config
-- name: Traefik Docker Container
- docker_container:
- name: traefik
- image: "{{ traefik_docker_image }}"
- pull: true
- network_mode: host
- volumes:
- - "{{ traefik_data_directory }}/traefik.toml:/etc/traefik/traefik.toml:ro"
- - "{{ traefik_data_directory }}/letsencrypt:/letsencrypt:rw"
- - "/var/run/docker.sock:/var/run/docker.sock:ro"
- env: "{{ traefik_environment_variables }}"
- restart_policy: unless-stopped
- memory: "{{ traefik_memory }}"
- recreate: "{{ template_config is changed }}"
+ - name: Traefik Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ traefik_container_name }}"
+ image: "{{ traefik_image_name }}:{{ traefik_image_version }}"
+ pull: true
+ network_mode: host
+ volumes:
+ - "{{ traefik_data_directory }}/traefik.toml:/etc/traefik/traefik.toml:ro"
+ - "{{ traefik_data_directory }}/letsencrypt:/letsencrypt:rw"
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
+ env: "{{ traefik_environment_variables }}"
+ restart_policy: unless-stopped
+ memory: "{{ traefik_memory }}"
+ recreate: "{{ template_config is changed }}"
+ when: traefik_enabled is true
+
+- name: Stop Traefik
+ block:
+ - name: Stop Traefik
+ community.docker.docker_container:
+ name: "{{ traefik_container_name }}"
+ state: absent
+ when: traefik_enabled is false
diff --git a/roles/transmission-with-openvpn/defaults/main.yml b/roles/transmission-with-openvpn/defaults/main.yml
index 80f33351..574f3ce2 100644
--- a/roles/transmission-with-openvpn/defaults/main.yml
+++ b/roles/transmission-with-openvpn/defaults/main.yml
@@ -22,6 +22,10 @@ transmission_openvpn_external_port: "51415"
transmission_openvpn_proxy_port: "3128"
transmission_openvpn_hostname: "transmission_openvpn"
+transmission_openvpn_container_name: "transmission-openvpn"
+transmission_openvpn_image_name: "haugene/transmission-openvpn"
+transmission_openvpn_image_version: "latest"
+
# Transmission VPN Credentials
# If you're using Transmission with a VPN, you'll need to set these credentials.
# See https://github.com/haugene/docker-transmission-openvpn/ for supported VPN providers.
diff --git a/roles/transmission-with-openvpn/molecule/default/molecule.yml b/roles/transmission-with-openvpn/molecule/default/molecule.yml
new file mode 100644
index 00000000..7cbfd317
--- /dev/null
+++ b/roles/transmission-with-openvpn/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ transmission_with_openvpn_enabled: true
diff --git a/roles/transmission-with-openvpn/molecule/default/side_effect.yml b/roles/transmission-with-openvpn/molecule/default/side_effect.yml
new file mode 100644
index 00000000..f3aa26e1
--- /dev/null
+++ b/roles/transmission-with-openvpn/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ transmission_with_openvpn_enabled: false
diff --git a/roles/transmission-with-openvpn/molecule/default/verify.yml b/roles/transmission-with-openvpn/molecule/default/verify.yml
new file mode 100644
index 00000000..748aef07
--- /dev/null
+++ b/roles/transmission-with-openvpn/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get transmission container state
+ community.docker.docker_container:
+ name: "{{ transmission_openvpn_container_name }}"
+ register: result
+
+ - name: Check if transmission containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/transmission-with-openvpn/molecule/default/verify_stopped.yml b/roles/transmission-with-openvpn/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..fa5d60dc
--- /dev/null
+++ b/roles/transmission-with-openvpn/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove transmission
+ community.docker.docker_container:
+ name: "{{ transmission_openvpn_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if transmission is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/transmission-with-openvpn/tasks/main.yml b/roles/transmission-with-openvpn/tasks/main.yml
index 5a67fbd9..6b9cd705 100644
--- a/roles/transmission-with-openvpn/tasks/main.yml
+++ b/roles/transmission-with-openvpn/tasks/main.yml
@@ -1,57 +1,69 @@
---
-- name: Create Transmission Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ transmission_config_directory }}"
- - "{{ transmission_download_directory }}"
- - "{{ transmission_watch_directory }}"
+- name: Start Transmission with OpenVPM
+ block:
+ - name: Create Transmission Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ transmission_config_directory }}"
+ - "{{ transmission_download_directory }}"
+ - "{{ transmission_watch_directory }}"
-- name: Transmission with VPN
- docker_container:
- name: transmission-openvpn
- image: haugene/transmission-openvpn
- pull: true
- volumes:
- - "/etc/localtime:/etc/localtime:ro"
- - "{{ transmission_download_directory }}:/downloads:rw"
- - "{{ transmission_config_directory }}:/config:rw"
- - "{{ transmission_watch_directory }}:/watch:rw"
- - "/etc/timezone:/etc/timezone:ro"
- ports:
- - "{{ transmission_openvpn_webui_port }}:9091"
- - "{{ transmission_openvpn_external_port }}:51413"
- - "{{ transmission_openvpn_external_port }}:51413/udp"
- - "{{ transmission_openvpn_proxy_port }}:3128"
- env:
- TRANSMISSION_HOME: "/config"
- TRANSMISSION_DOWNLOAD_DIR: "/downloads"
- TRANSMISSION_INCOMPLETE_DIR: "/downloads/.incomplete"
- TRANSMISSION_WATCH_DIR: "/watch"
- TRANSMISSION_RATIO_LIMIT: "{{ transmission_openvpn_ratio_limit }}"
- TRANSMISSION_RATIO_LIMIT_ENABLED: "{{ transmission_openvpn_ratio_limit_enabled | string }}"
- OPENVPN_PROVIDER: "{{ openvpn_provider }}"
- OPENVPN_USERNAME: "{{ openvpn_username }}"
- OPENVPN_PASSWORD: "{{ openvpn_password }}"
- OPENVPN_CONFIG: "{{ openvpn_config }}"
- WEBPROXY_ENABLED: "true"
- WEBPROXY_PORT: "3128"
- PUID: "{{ transmission_openvpn_user_id }}"
- PGID: "{{ transmission_openvpn_group_id }}"
- LOCAL_NETWORK: "{{ transmission_openvpn_local_network }}"
- ENABLE_UFW: "false"
- devices:
- - /dev/net/tun
- capabilities:
- - NET_ADMIN
- restart_policy: unless-stopped
- memory: "{{ transmission_openvpn_memory }}"
- labels:
- traefik.enable: "{{ transmission_openvpn_available_externally | string }}"
- traefik.http.routers.transmission_openvpn.rule: "Host(`{{ transmission_openvpn_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.transmission_openvpn.tls.certresolver: "letsencrypt"
- traefik.http.routers.transmission_openvpn.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.transmission_openvpn.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.transmission_openvpn.loadbalancer.server.port: "9091"
+ - name: Transmission with VPN
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ transmission_openvpn_container_name }}"
+ image: "{{ transmission_openvpn_image_name }}:{{ transmission_openvpn_image_version }}"
+ pull: true
+ volumes:
+ - "/etc/localtime:/etc/localtime:ro"
+ - "{{ transmission_download_directory }}:/downloads:rw"
+ - "{{ transmission_config_directory }}:/config:rw"
+ - "{{ transmission_watch_directory }}:/watch:rw"
+ - "/etc/timezone:/etc/timezone:ro"
+ ports:
+ - "{{ transmission_openvpn_webui_port }}:9091"
+ - "{{ transmission_openvpn_external_port }}:51413"
+ - "{{ transmission_openvpn_external_port }}:51413/udp"
+ - "{{ transmission_openvpn_proxy_port }}:3128"
+ env:
+ TRANSMISSION_HOME: "/config"
+ TRANSMISSION_DOWNLOAD_DIR: "/downloads"
+ TRANSMISSION_INCOMPLETE_DIR: "/downloads/.incomplete"
+ TRANSMISSION_WATCH_DIR: "/watch"
+ TRANSMISSION_RATIO_LIMIT: "{{ transmission_openvpn_ratio_limit }}"
+ TRANSMISSION_RATIO_LIMIT_ENABLED: "{{ transmission_openvpn_ratio_limit_enabled | string }}"
+ OPENVPN_PROVIDER: "{{ openvpn_provider }}"
+ OPENVPN_USERNAME: "{{ openvpn_username }}"
+ OPENVPN_PASSWORD: "{{ openvpn_password }}"
+ OPENVPN_CONFIG: "{{ openvpn_config }}"
+ WEBPROXY_ENABLED: "true"
+ WEBPROXY_PORT: "3128"
+ PUID: "{{ transmission_openvpn_user_id }}"
+ PGID: "{{ transmission_openvpn_group_id }}"
+ LOCAL_NETWORK: "{{ transmission_openvpn_local_network }}"
+ ENABLE_UFW: "false"
+ devices:
+ - /dev/net/tun
+ capabilities:
+ - NET_ADMIN
+ restart_policy: unless-stopped
+ memory: "{{ transmission_openvpn_memory }}"
+ labels:
+ traefik.enable: "{{ transmission_with_openvpn_available_externally | string }}"
+ traefik.http.routers.transmission_openvpn.rule: "Host(`{{ transmission_openvpn_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.transmission_openvpn.tls.certresolver: "letsencrypt"
+ traefik.http.routers.transmission_openvpn.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.transmission_openvpn.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.transmission_openvpn.loadbalancer.server.port: "9091"
+ when: transmission_with_openvpn_enabled is true
+
+- name: Stop Transmission with OpenVPM
+ block:
+ - name: Stop Transmission with OpenVPM
+ community.docker.docker_container:
+ name: "{{ transmission_openvpn_container_name }}"
+ state: absent
+ when: transmission_with_openvpn_enabled is false
diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml
index e8721a95..dd5d2759 100644
--- a/roles/transmission/defaults/main.yml
+++ b/roles/transmission/defaults/main.yml
@@ -18,5 +18,9 @@ transmission_hostname: "transmission"
transmission_timezone: "{{ ansible_nas_timezone }}"
+transmission_container_name: "transmission"
+transmission_image_name: "linuxserver/transmission"
+transmission_image_version: "latest"
+
# specs
transmission_memory: 1g
diff --git a/roles/transmission/molecule/default/molecule.yml b/roles/transmission/molecule/default/molecule.yml
new file mode 100644
index 00000000..84279777
--- /dev/null
+++ b/roles/transmission/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ transmission_enabled: true
diff --git a/roles/transmission/molecule/default/side_effect.yml b/roles/transmission/molecule/default/side_effect.yml
new file mode 100644
index 00000000..29ef54a6
--- /dev/null
+++ b/roles/transmission/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ transmission_enabled: false
diff --git a/roles/transmission/molecule/default/verify.yml b/roles/transmission/molecule/default/verify.yml
new file mode 100644
index 00000000..101dceb5
--- /dev/null
+++ b/roles/transmission/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get transmission container state
+ community.docker.docker_container:
+ name: "{{ transmission_container_name }}"
+ register: result
+
+ - name: Check if transmission containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/transmission/molecule/default/verify_stopped.yml b/roles/transmission/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..bea8a2ed
--- /dev/null
+++ b/roles/transmission/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove transmission
+ community.docker.docker_container:
+ name: "{{ transmission_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if transmission is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml
index aeaf5e29..d8518421 100644
--- a/roles/transmission/tasks/main.yml
+++ b/roles/transmission/tasks/main.yml
@@ -1,37 +1,49 @@
---
-- name: Create Transmission Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ transmission_config_directory }}"
- - "{{ transmission_download_directory }}"
- - "{{ transmission_watch_directory }}"
+- name: Start Transmission
+ block:
+ - name: Create Transmission Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ transmission_config_directory }}"
+ - "{{ transmission_download_directory }}"
+ - "{{ transmission_watch_directory }}"
-- name: Transmission Docker Container
- docker_container:
- name: transmission
- image: linuxserver/transmission
- pull: true
- volumes:
- - "{{ transmission_config_directory }}:/config:rw"
- - "{{ transmission_download_directory }}:/downloads:rw"
- - "{{ transmission_watch_directory }}:/watch:rw"
- ports:
- - "{{ transmission_webui_port }}:9091"
- - "{{ transmission_external_port }}:51413"
- - "{{ transmission_external_port }}:51413/udp"
- env:
- TZ: "{{ transmission_timezone }}"
- PUID: "{{ transmission_user_id }}"
- PGID: "{{ transmission_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ transmission_memory }}"
- labels:
- traefik.enable: "{{ transmission_available_externally | string }}"
- traefik.http.routers.transmission.rule: "Host(`{{ transmission_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.transmission.tls.certresolver: "letsencrypt"
- traefik.http.routers.transmission.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.transmission.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.transmission.loadbalancer.server.port: "9091"
+ - name: Transmission Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ transmission_container_name }}"
+ image: "{{ transmission_image_name }}:{{ transmission_image_version }}"
+ pull: true
+ volumes:
+ - "{{ transmission_config_directory }}:/config:rw"
+ - "{{ transmission_download_directory }}:/downloads:rw"
+ - "{{ transmission_watch_directory }}:/watch:rw"
+ ports:
+ - "{{ transmission_webui_port }}:9091"
+ - "{{ transmission_external_port }}:51413"
+ - "{{ transmission_external_port }}:51413/udp"
+ env:
+ TZ: "{{ transmission_timezone }}"
+ PUID: "{{ transmission_user_id }}"
+ PGID: "{{ transmission_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ transmission_memory }}"
+ labels:
+ traefik.enable: "{{ transmission_available_externally | string }}"
+ traefik.http.routers.transmission.rule: "Host(`{{ transmission_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.transmission.tls.certresolver: "letsencrypt"
+ traefik.http.routers.transmission.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.transmission.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.transmission.loadbalancer.server.port: "9091"
+ when: transmission_enabled is true
+
+- name: Stop Transmission
+ block:
+ - name: Stop Transmission
+ community.docker.docker_container:
+ name: "{{ transmission_container_name }}"
+ state: absent
+ when: transmission_enabled is false
diff --git a/roles/ubooquity/defaults/main.yml b/roles/ubooquity/defaults/main.yml
index de447145..106917b4 100644
--- a/roles/ubooquity/defaults/main.yml
+++ b/roles/ubooquity/defaults/main.yml
@@ -16,3 +16,6 @@ ubooquity_hostname: ubooquity
# Container
ubooquity_memory: 1g
+ubooquity_container_name: "ubooquity"
+ubooquity_image_name: "linuxserver/ubooquity"
+ubooquity_image_version: "latest"
diff --git a/roles/ubooquity/molecule/default/molecule.yml b/roles/ubooquity/molecule/default/molecule.yml
new file mode 100644
index 00000000..2d3b0986
--- /dev/null
+++ b/roles/ubooquity/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ ubooquity_enabled: true
diff --git a/roles/ubooquity/molecule/default/side_effect.yml b/roles/ubooquity/molecule/default/side_effect.yml
new file mode 100644
index 00000000..da6776f5
--- /dev/null
+++ b/roles/ubooquity/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ ubooquity_enabled: false
diff --git a/roles/ubooquity/molecule/default/verify.yml b/roles/ubooquity/molecule/default/verify.yml
new file mode 100644
index 00000000..4471805a
--- /dev/null
+++ b/roles/ubooquity/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get ubooquity container state
+ community.docker.docker_container:
+ name: "{{ ubooquity_container_name }}"
+ register: result
+
+ - name: Check if ubooquity containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/ubooquity/molecule/default/verify_stopped.yml b/roles/ubooquity/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..ecdd6f81
--- /dev/null
+++ b/roles/ubooquity/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove ubooquity
+ community.docker.docker_container:
+ name: "{{ ubooquity_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if ubooquity is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/ubooquity/tasks/main.yml b/roles/ubooquity/tasks/main.yml
index 8e254a4d..82309851 100644
--- a/roles/ubooquity/tasks/main.yml
+++ b/roles/ubooquity/tasks/main.yml
@@ -1,35 +1,47 @@
---
-- name: Create Ubooquity Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ ubooquity_data_directory }}"
+- name: Start Ubooquity
+ block:
+ - name: Create Ubooquity Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ ubooquity_data_directory }}"
-- name: Ubooquity Docker Container
- docker_container:
- name: ubooquity
- image: linuxserver/ubooquity:latest
- pull: true
- volumes:
- - "{{ ubooquity_data_directory }}/config:/config:rw"
- - "{{ ubooquity_data_directory }}/files:/files:rw"
- - "{{ comics_root }}:/comics"
- - "{{ books_root }}:/books"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ ubooquity_user_id }}"
- PGID: "{{ ubooquity_group_id }}"
- MAXMEM: "1024"
- ports:
- - "{{ ubooquity_port_webui }}:2202"
- - "{{ ubooquity_port_admin }}:2203"
- restart_policy: unless-stopped
- memory: "{{ ubooquity_memory }}"
- labels:
- traefik.enable: "{{ ubooquity_available_externally | string }}"
- traefik.http.routers.ubooquity.rule: "Host(`{{ ubooquity_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.ubooquity.tls.certresolver: "letsencrypt"
- traefik.http.routers.ubooquity.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.ubooquity.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.ubooquity.loadbalancer.server.port: "2202"
+ - name: Ubooquity Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ ubooquity_container_name }}"
+ image: "{{ ubooquity_image_name }}:{{ ubooquity_image_version }}"
+ pull: true
+ volumes:
+ - "{{ ubooquity_data_directory }}/config:/config:rw"
+ - "{{ ubooquity_data_directory }}/files:/files:rw"
+ - "{{ comics_root }}:/comics"
+ - "{{ books_root }}:/books"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ ubooquity_user_id }}"
+ PGID: "{{ ubooquity_group_id }}"
+ MAXMEM: "1024"
+ ports:
+ - "{{ ubooquity_port_webui }}:2202"
+ - "{{ ubooquity_port_admin }}:2203"
+ restart_policy: unless-stopped
+ memory: "{{ ubooquity_memory }}"
+ labels:
+ traefik.enable: "{{ ubooquity_available_externally | string }}"
+ traefik.http.routers.ubooquity.rule: "Host(`{{ ubooquity_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.ubooquity.tls.certresolver: "letsencrypt"
+ traefik.http.routers.ubooquity.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.ubooquity.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.ubooquity.loadbalancer.server.port: "2202"
+ when: ubooquity_enabled is true
+
+- name: Stop Ubooquity
+ block:
+ - name: Stop Ubooquity
+ community.docker.docker_container:
+ name: "{{ ubooquity_container_name }}"
+ state: absent
+ when: ubooquity_enabled is false
diff --git a/roles/utorrent/defaults/main.yml b/roles/utorrent/defaults/main.yml
index aba2fe73..df3170eb 100644
--- a/roles/utorrent/defaults/main.yml
+++ b/roles/utorrent/defaults/main.yml
@@ -16,5 +16,10 @@ utorrent_port_http: "8111"
utorrent_port_bt: "6881"
utorrent_hostname: "utorrent"
+# docker
+utorrent_container_name: "utorrent"
+utorrent_image_name: "ekho/utorrent"
+utorrent_image_version: "latest"
+
# specs
utorrent_memory: 1g
diff --git a/roles/utorrent/molecule/default/molecule.yml b/roles/utorrent/molecule/default/molecule.yml
new file mode 100644
index 00000000..f4fa84ef
--- /dev/null
+++ b/roles/utorrent/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ utorrent_enabled: true
diff --git a/roles/utorrent/molecule/default/side_effect.yml b/roles/utorrent/molecule/default/side_effect.yml
new file mode 100644
index 00000000..d496124e
--- /dev/null
+++ b/roles/utorrent/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ utorrent_enabled: false
diff --git a/roles/utorrent/molecule/default/verify.yml b/roles/utorrent/molecule/default/verify.yml
new file mode 100644
index 00000000..b2f6d3ec
--- /dev/null
+++ b/roles/utorrent/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get utorrent container state
+ community.docker.docker_container:
+ name: "{{ utorrent_container_name }}"
+ register: result
+
+ - name: Check if utorrent containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/utorrent/molecule/default/verify_stopped.yml b/roles/utorrent/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..76d5347d
--- /dev/null
+++ b/roles/utorrent/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove utorrent
+ community.docker.docker_container:
+ name: "{{ utorrent_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if utorrent is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/utorrent/tasks/main.yml b/roles/utorrent/tasks/main.yml
index 5aa5a8ed..1a7c99e0 100644
--- a/roles/utorrent/tasks/main.yml
+++ b/roles/utorrent/tasks/main.yml
@@ -1,39 +1,51 @@
---
-- name: Create uTorrent Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ utorrent_config_directory }}"
- - "{{ utorrent_download_directory }}"
- - "{{ utorrent_download_directory_active }}"
+- name: Start uTorrent
+ block:
+ - name: Create uTorrent Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ utorrent_config_directory }}"
+ - "{{ utorrent_download_directory }}"
+ - "{{ utorrent_download_directory_active }}"
-- name: Create uTorrent Docker Container
- docker_container:
- name: utorrent
- image: ekho/utorrent:latest
- pull: true
- volumes:
- - "{{ utorrent_download_directory }}:/data:rw"
- - "{{ utorrent_config_directory }}:/utorrent/settings:rw"
- - "{{ torrents_root }}:/utorrent/torrents:rw"
- ports:
- - "{{ utorrent_port_http }}:8080"
- - "{{ utorrent_port_bt }}:6881"
- - "{{ utorrent_port_bt }}:6881/udp"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- UID: "{{ utorrent_user_id }}"
- GID: "{{ utorrent_group_id }}"
- webui: "ng"
- dir_active: "/data/.incomplete"
- dir_completed: "/data"
- restart_policy: unless-stopped
- memory: "{{ utorrent_memory }}"
- labels:
- traefik.enable: "{{ utorrent_available_externally | string }}"
- traefik.http.routers.utorrent.rule: "Host(`{{ utorrent_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.utorrent.tls.certresolver: "letsencrypt"
- traefik.http.routers.utorrent.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.utorrent.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.utorrent.loadbalancer.server.port: "8080"
+ - name: Create uTorrent Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ utorrent_container_name }}"
+ image: "{{ utorrent_image_name }}:{{ utorrent_image_version }}"
+ pull: true
+ volumes:
+ - "{{ utorrent_download_directory }}:/data:rw"
+ - "{{ utorrent_config_directory }}:/utorrent/settings:rw"
+ - "{{ torrents_root }}:/utorrent/torrents:rw"
+ ports:
+ - "{{ utorrent_port_http }}:8080"
+ - "{{ utorrent_port_bt }}:6881"
+ - "{{ utorrent_port_bt }}:6881/udp"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ UID: "{{ utorrent_user_id }}"
+ GID: "{{ utorrent_group_id }}"
+ webui: "ng"
+ dir_active: "/data/.incomplete"
+ dir_completed: "/data"
+ restart_policy: unless-stopped
+ memory: "{{ utorrent_memory }}"
+ labels:
+ traefik.enable: "{{ utorrent_available_externally | string }}"
+ traefik.http.routers.utorrent.rule: "Host(`{{ utorrent_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.utorrent.tls.certresolver: "letsencrypt"
+ traefik.http.routers.utorrent.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.utorrent.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.utorrent.loadbalancer.server.port: "8080"
+ when: utorrent_enabled is true
+
+- name: Stop uTorrent
+ block:
+ - name: Stop uTorrent
+ community.docker.docker_container:
+ name: "{{ utorrent_container_name }}"
+ state: absent
+ when: utorrent_enabled is false
diff --git a/roles/virtual_desktop/defaults/main.yml b/roles/virtual_desktop/defaults/main.yml
index 0cd61c79..effb7b3f 100644
--- a/roles/virtual_desktop/defaults/main.yml
+++ b/roles/virtual_desktop/defaults/main.yml
@@ -1,8 +1,6 @@
---
virtual_desktop_enabled: false
-virtual_desktop_docker_image: "rattydave/docker-ubuntu-xrdp-mate-custom:20.04-tools"
-
virtual_desktop_users:
- username: "{{ ansible_nas_user }}"
password: "topsecret"
@@ -20,3 +18,6 @@ virtual_desktop_rdp_port: 3389
# Container
virtual_desktop_memory: 2g
+virtual_desktop_container_name: "virtual_desktop"
+virtual_desktop_image_name: "rattydave/docker-ubuntu-xrdp-mate-custom"
+virtual_desktop_image_version: "20.04-tools"
diff --git a/roles/virtual_desktop/molecule/default/molecule.yml b/roles/virtual_desktop/molecule/default/molecule.yml
new file mode 100644
index 00000000..b9f24f26
--- /dev/null
+++ b/roles/virtual_desktop/molecule/default/molecule.yml
@@ -0,0 +1,7 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ virtual_desktop_enabled: true
+ ansible_nas_user: ansible-nas
diff --git a/roles/virtual_desktop/molecule/default/side_effect.yml b/roles/virtual_desktop/molecule/default/side_effect.yml
new file mode 100644
index 00000000..b73186e1
--- /dev/null
+++ b/roles/virtual_desktop/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ virtual_desktop_enabled: false
diff --git a/roles/virtual_desktop/molecule/default/verify.yml b/roles/virtual_desktop/molecule/default/verify.yml
new file mode 100644
index 00000000..0058aa98
--- /dev/null
+++ b/roles/virtual_desktop/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get virtual_desktop container state
+ community.docker.docker_container:
+ name: "{{ virtual_desktop_container_name }}"
+ register: result
+
+ - name: Check if virtual_desktop containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/virtual_desktop/molecule/default/verify_stopped.yml b/roles/virtual_desktop/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..0d846858
--- /dev/null
+++ b/roles/virtual_desktop/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove virtual_desktop
+ community.docker.docker_container:
+ name: "{{ virtual_desktop_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if virtual_desktop is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/virtual_desktop/tasks/main.yml b/roles/virtual_desktop/tasks/main.yml
index 167dd08a..90ccb1c2 100644
--- a/roles/virtual_desktop/tasks/main.yml
+++ b/roles/virtual_desktop/tasks/main.yml
@@ -1,30 +1,42 @@
---
-- name: Create Virtual Desktop Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ virtual_desktop_data_directory }}"
- - "{{ virtual_desktop_data_directory }}/home"
+- name: Start Virtual Desktop
+ block:
+ - name: Create Virtual Desktop Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ virtual_desktop_data_directory }}"
+ - "{{ virtual_desktop_data_directory }}/home"
-- name: Create users file
- template:
- src: "users.txt.j2"
- dest: "{{ virtual_desktop_data_directory }}/users.txt"
+ - name: Create users file
+ ansible.builtin.template:
+ src: "users.txt.j2"
+ dest: "{{ virtual_desktop_data_directory }}/users.txt"
-- name: Virtual Desktop Container
- docker_container:
- name: virtual_desktop
- image: "{{ virtual_desktop_docker_image }}"
- pull: true
- volumes:
- - "{{ virtual_desktop_data_directory }}/users.txt:/root/createusers.txt:ro"
- - "{{ virtual_desktop_data_directory }}/home:/home:rw"
- - "{{ samba_shares_root }}:/samba:rw"
- - "{{ docker_home }}:/docker:rw"
- - "/etc/timezone:/etc/timezone:ro"
- ports:
- - "{{ virtual_desktop_rdp_port }}:3389"
- privileged: true
- restart_policy: unless-stopped
- memory: "{{ virtual_desktop_memory }}"
+ - name: Virtual Desktop Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ virtual_desktop_container_name }}"
+ image: "{{ virtual_desktop_image_name }}:{{ virtual_desktop_image_version }}"
+ pull: true
+ volumes:
+ - "{{ virtual_desktop_data_directory }}/users.txt:/root/createusers.txt:ro"
+ - "{{ virtual_desktop_data_directory }}/home:/home:rw"
+ - "{{ samba_shares_root }}:/samba:rw"
+ - "{{ docker_home }}:/docker:rw"
+ - "/etc/timezone:/etc/timezone:ro"
+ ports:
+ - "{{ virtual_desktop_rdp_port }}:3389"
+ privileged: true
+ restart_policy: unless-stopped
+ memory: "{{ virtual_desktop_memory }}"
+ when: virtual_desktop_enabled is true
+
+- name: Stop Virtual Desktop
+ block:
+ - name: Stop Virtual Desktop
+ community.docker.docker_container:
+ name: "{{ virtual_desktop_container_name }}"
+ state: absent
+ when: virtual_desktop_enabled is false
diff --git a/roles/wallabag/defaults/main.yml b/roles/wallabag/defaults/main.yml
index b96f280b..fd5a5488 100644
--- a/roles/wallabag/defaults/main.yml
+++ b/roles/wallabag/defaults/main.yml
@@ -11,3 +11,6 @@ wallabag_hostname: wallabag
# Container
wallabag_memory: 1g
+wallabag_container_name: "wallabag"
+wallabag_image_name: "wallabag/wallabag"
+wallabag_image_version: "latest"
diff --git a/roles/wallabag/molecule/default/molecule.yml b/roles/wallabag/molecule/default/molecule.yml
new file mode 100644
index 00000000..3e2adc75
--- /dev/null
+++ b/roles/wallabag/molecule/default/molecule.yml
@@ -0,0 +1,17 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ wallabag_enabled: true
+ wallabag_data_directory: "/tmp/wallabag"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp
+ cgroupns_mode: host
+ privileged: true
+ pre_build_image: true
diff --git a/roles/wallabag/molecule/default/side_effect.yml b/roles/wallabag/molecule/default/side_effect.yml
new file mode 100644
index 00000000..7bd20b86
--- /dev/null
+++ b/roles/wallabag/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ wallabag_enabled: false
diff --git a/roles/wallabag/molecule/default/verify.yml b/roles/wallabag/molecule/default/verify.yml
new file mode 100644
index 00000000..b710d9f5
--- /dev/null
+++ b/roles/wallabag/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get wallabag container state
+ community.docker.docker_container:
+ name: "{{ wallabag_container_name }}"
+ register: result
+
+ - name: Check if wallabag containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/wallabag/molecule/default/verify_stopped.yml b/roles/wallabag/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..2fdd59b8
--- /dev/null
+++ b/roles/wallabag/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove wallabag
+ community.docker.docker_container:
+ name: "{{ wallabag_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if wallabag is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/wallabag/tasks/main.yml b/roles/wallabag/tasks/main.yml
index eb1e67e7..a296c2c3 100644
--- a/roles/wallabag/tasks/main.yml
+++ b/roles/wallabag/tasks/main.yml
@@ -1,30 +1,45 @@
---
-- name: Create Wallabag Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ wallabag_data_directory }}/data"
- - "{{ wallabag_data_directory }}/images"
+- name: Start Wallabag
+ block:
+ - name: Create Wallabag Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ owner: 65534
+ group: 65534
+ with_items:
+ - "{{ wallabag_data_directory }}/data"
+ - "{{ wallabag_data_directory }}/data/db"
+ - "{{ wallabag_data_directory }}/images"
-- name: Wallabag Docker Container
- docker_container:
- name: wallabag
- image: wallabag/wallabag:latest
- pull: true
- volumes:
- - "{{ wallabag_data_directory }}/data:/var/www/wallabag/data:rw"
- - "{{ wallabag_data_directory }}/images:/var/www/wallabag/web/assets/images:rw"
- ports:
- - "{{ wallabag_port }}:80"
- env:
- SYMFONY__ENV__DOMAIN_NAME: "https://wallabag.{{ ansible_nas_domain }}"
- restart_policy: unless-stopped
- memory: "{{ wallabag_memory }}"
- labels:
- traefik.enable: "{{ wallabag_available_externally | string }}"
- traefik.http.routers.wallabag.rule: "Host(`{{ wallabag_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.wallabag.tls.certresolver: "letsencrypt"
- traefik.http.routers.wallabag.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.wallabag.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.wallabag.loadbalancer.server.port: "80"
+ - name: Wallabag Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ wallabag_container_name }}"
+ image: "{{ wallabag_image_name }}:{{ wallabag_image_version }}"
+ pull: true
+ volumes:
+ - "{{ wallabag_data_directory }}/data:/var/www/wallabag/data:rw"
+ - "{{ wallabag_data_directory }}/images:/var/www/wallabag/web/assets/images:rw"
+ ports:
+ - "{{ wallabag_port }}:80"
+ env:
+ SYMFONY__ENV__DOMAIN_NAME: "https://wallabag.{{ ansible_nas_domain }}"
+ restart_policy: unless-stopped
+ memory: "{{ wallabag_memory }}"
+ labels:
+ traefik.enable: "{{ wallabag_available_externally | string }}"
+ traefik.http.routers.wallabag.rule: "Host(`{{ wallabag_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.wallabag.tls.certresolver: "letsencrypt"
+ traefik.http.routers.wallabag.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.wallabag.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.wallabag.loadbalancer.server.port: "80"
+ when: wallabag_enabled is true
+
+- name: Stop Wallabag
+ block:
+ - name: Stop Wallabag
+ community.docker.docker_container:
+ name: "{{ wallabag_container_name }}"
+ state: absent
+ when: wallabag_enabled is false
diff --git a/roles/watchtower/defaults/main.yml b/roles/watchtower/defaults/main.yml
index cdb8bcd9..4fe8816b 100644
--- a/roles/watchtower/defaults/main.yml
+++ b/roles/watchtower/defaults/main.yml
@@ -18,3 +18,7 @@ watchtower_command: "--schedule '{{ watchtower_cron_schedule }}'"
# specs
watchtower_memory: 1g
+
+watchtower_container_name: "watchtower"
+watchtower_image_name: "containrrr/watchtower"
+watchtower_image_version: "latest"
diff --git a/roles/watchtower/molecule/default/molecule.yml b/roles/watchtower/molecule/default/molecule.yml
new file mode 100644
index 00000000..74e78e02
--- /dev/null
+++ b/roles/watchtower/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ watchtower_enabled: true
diff --git a/roles/watchtower/molecule/default/side_effect.yml b/roles/watchtower/molecule/default/side_effect.yml
new file mode 100644
index 00000000..754cd6fb
--- /dev/null
+++ b/roles/watchtower/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ watchtower_enabled: false
diff --git a/roles/watchtower/molecule/default/verify.yml b/roles/watchtower/molecule/default/verify.yml
new file mode 100644
index 00000000..11e56dd0
--- /dev/null
+++ b/roles/watchtower/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get watchtower container state
+ community.docker.docker_container:
+ name: "{{ watchtower_container_name }}"
+ register: result
+
+ - name: Check if watchtower containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/watchtower/molecule/default/verify_stopped.yml b/roles/watchtower/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..d9355580
--- /dev/null
+++ b/roles/watchtower/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove watchtower
+ community.docker.docker_container:
+ name: "{{ watchtower_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if watchtower is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/watchtower/tasks/main.yml b/roles/watchtower/tasks/main.yml
index 7b8f1a16..0e0212b1 100644
--- a/roles/watchtower/tasks/main.yml
+++ b/roles/watchtower/tasks/main.yml
@@ -1,13 +1,25 @@
---
-- name: Watchtower Docker Container
- docker_container:
- name: watchtower
- image: containrrr/watchtower
- pull: true
- volumes:
- - "/var/run/docker.sock:/var/run/docker.sock"
- env:
- TZ: "{{ ansible_nas_timezone }}"
- command: "{{ watchtower_command }}"
- restart_policy: unless-stopped
- memory: "{{ watchtower_memory }}"
+- name: Start Watchtower
+ block:
+ - name: Watchtower Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ watchtower_container_name }}"
+ image: "{{ watchtower_image_name }}:{{ watchtower_image_version }}"
+ pull: true
+ volumes:
+ - "/var/run/docker.sock:/var/run/docker.sock"
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ command: "{{ watchtower_command }}"
+ restart_policy: unless-stopped
+ memory: "{{ watchtower_memory }}"
+ when: watchtower_enabled is true
+
+- name: Stop Watchtower
+ block:
+ - name: Stop Watchtower
+ community.docker.docker_container:
+ name: "{{ watchtower_container_name }}"
+ state: absent
+ when: watchtower_enabled is false
diff --git a/roles/wireshark/defaults/main.yml b/roles/wireshark/defaults/main.yml
index 30e729ec..0a3ea1cf 100644
--- a/roles/wireshark/defaults/main.yml
+++ b/roles/wireshark/defaults/main.yml
@@ -13,5 +13,10 @@ wireshark_group_id: "1000"
# network
wireshark_hostname: "wireshark"
+# docker
+wireshark_container_name: "wireshark"
+wireshark_image_name: "linuxserver/wireshark"
+wireshark_image_version: "latest"
+
# specs
wireshark_memory: "512m"
diff --git a/roles/wireshark/molecule/default/molecule.yml b/roles/wireshark/molecule/default/molecule.yml
new file mode 100644
index 00000000..840106ce
--- /dev/null
+++ b/roles/wireshark/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ wireshark_enabled: true
diff --git a/roles/wireshark/molecule/default/side_effect.yml b/roles/wireshark/molecule/default/side_effect.yml
new file mode 100644
index 00000000..98514c9a
--- /dev/null
+++ b/roles/wireshark/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ wireshark_enabled: false
diff --git a/roles/wireshark/molecule/default/verify.yml b/roles/wireshark/molecule/default/verify.yml
new file mode 100644
index 00000000..5595dbd4
--- /dev/null
+++ b/roles/wireshark/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get wireshark container state
+ community.docker.docker_container:
+ name: "{{ wireshark_container_name }}"
+ register: result
+
+ - name: Check if wireshark containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/wireshark/molecule/default/verify_stopped.yml b/roles/wireshark/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..572d11d1
--- /dev/null
+++ b/roles/wireshark/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove wireshark
+ community.docker.docker_container:
+ name: "{{ wireshark_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if wireshark is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/wireshark/tasks/main.yml b/roles/wireshark/tasks/main.yml
index 318ecaae..e094a8e1 100644
--- a/roles/wireshark/tasks/main.yml
+++ b/roles/wireshark/tasks/main.yml
@@ -1,32 +1,44 @@
---
-- name: Create Wireshark Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ wireshark_data_directory }}"
- - "{{ wireshark_data_directory }}/config"
+- name: Start Wireshark
+ block:
+ - name: Create Wireshark Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ wireshark_data_directory }}"
+ - "{{ wireshark_data_directory }}/config"
-- name: Create Wireshark Docker Container
- docker_container:
- name: wireshark
- image: linuxserver/wireshark:latest
- pull: true
- volumes:
- - "{{ wireshark_data_directory }}/config:/config:rw"
- network_mode: host
- env:
- TZ: "{{ ansible_nas_timezone }}"
- PUID: "{{ wireshark_user_id }}"
- PGID: "{{ wireshark_group_id }}"
- capabilities:
- - NET_ADMIN
- restart_policy: unless-stopped
- memory: "{{ wireshark_memory }}"
- labels:
- traefik.enable: "{{ wireshark_available_externally | string }}"
- traefik.http.routers.wireshark.rule: "Host(`{{ wireshark_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.wireshark.tls.certresolver: "letsencrypt"
- traefik.http.routers.wireshark.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.wireshark.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.wireshark.loadbalancer.server.port: "3000"
+ - name: Create Wireshark Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ wireshark_container_name }}"
+ image: "{{ wireshark_image_name }}:{{ wireshark_image_version }}"
+ pull: true
+ volumes:
+ - "{{ wireshark_data_directory }}/config:/config:rw"
+ network_mode: host
+ env:
+ TZ: "{{ ansible_nas_timezone }}"
+ PUID: "{{ wireshark_user_id }}"
+ PGID: "{{ wireshark_group_id }}"
+ capabilities:
+ - NET_ADMIN
+ restart_policy: unless-stopped
+ memory: "{{ wireshark_memory }}"
+ labels:
+ traefik.enable: "{{ wireshark_available_externally | string }}"
+ traefik.http.routers.wireshark.rule: "Host(`{{ wireshark_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.wireshark.tls.certresolver: "letsencrypt"
+ traefik.http.routers.wireshark.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.wireshark.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.wireshark.loadbalancer.server.port: "3000"
+ when: wireshark_enabled is true
+
+- name: Stop Wireshark
+ block:
+ - name: Stop Wireshark
+ community.docker.docker_container:
+ name: "{{ wireshark_container_name }}"
+ state: absent
+ when: wireshark_enabled is false
diff --git a/roles/woodpecker-ci/defaults/main.yml b/roles/woodpecker-ci/defaults/main.yml
index 75252387..1616d778 100644
--- a/roles/woodpecker-ci/defaults/main.yml
+++ b/roles/woodpecker-ci/defaults/main.yml
@@ -11,6 +11,15 @@ woodpecker_ci_port_grpc: 9000
woodpecker_ci_address: "http://{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ woodpecker_ci_port_ui }}"
woodpecker_ci_hostname: woodpecker-ci
+# docker
+woodpecker_ci_container_name: "woodpecker-ci"
+woodpecker_ci_image_name: "woodpeckerci/woodpecker-server"
+woodpecker_ci_image_version: "latest"
+
+woodpecker_ci_agent_container_name: "woodpecker-ci-agent"
+woodpecker_ci_agent_image_name: "woodpeckerci/woodpecker-agent"
+woodpecker_ci_agent_image_version: "latest"
+
# memory
woodpecker_ci_memory: 1g
woodpecker_ci_agent_memory: 1g
diff --git a/roles/woodpecker-ci/molecule/default/molecule.yml b/roles/woodpecker-ci/molecule/default/molecule.yml
new file mode 100644
index 00000000..b1140484
--- /dev/null
+++ b/roles/woodpecker-ci/molecule/default/molecule.yml
@@ -0,0 +1,22 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ woodpecker_ci_enabled: true
+ gitea_enabled: true
+ woodpecker_ci_gitea_client: "test"
+ gitea_port_http: "8080"
+ gitea_data_directory: "/tmp/gitea"
+ playbooks:
+ prepare: prepare.yml
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp
+ cgroupns_mode: host
+ privileged: true
+ pre_build_image: true
diff --git a/roles/woodpecker-ci/molecule/default/prepare.yml b/roles/woodpecker-ci/molecule/default/prepare.yml
new file mode 100644
index 00000000..2ada4b06
--- /dev/null
+++ b/roles/woodpecker-ci/molecule/default/prepare.yml
@@ -0,0 +1,20 @@
+---
+- name: Prepare
+ hosts: all
+ tasks:
+ - name: Install docker python module
+ ansible.builtin.pip:
+ name: docker
+
+ - name: Create a dummy gitea config directory
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ recurse: yes
+ with_items:
+ - "{{ gitea_data_directory }}/gitea/gitea/conf"
+
+ - name: Create a dummy gitea config file
+ ansible.builtin.file:
+ path: "{{ gitea_data_directory }}/gitea/gitea/conf/app.ini"
+ state: touch
diff --git a/roles/woodpecker-ci/molecule/default/side_effect.yml b/roles/woodpecker-ci/molecule/default/side_effect.yml
new file mode 100644
index 00000000..61d1c23c
--- /dev/null
+++ b/roles/woodpecker-ci/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ woodpecker_ci_enabled: false
diff --git a/roles/woodpecker-ci/molecule/default/verify.yml b/roles/woodpecker-ci/molecule/default/verify.yml
new file mode 100644
index 00000000..7d01d15c
--- /dev/null
+++ b/roles/woodpecker-ci/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get woodpecker_ci container state
+ community.docker.docker_container:
+ name: "{{ woodpecker_ci_container_name }}"
+ register: result
+
+ - name: Check if woodpecker_ci containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/woodpecker-ci/molecule/default/verify_stopped.yml b/roles/woodpecker-ci/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..887373bd
--- /dev/null
+++ b/roles/woodpecker-ci/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove woodpecker_ci
+ community.docker.docker_container:
+ name: "{{ woodpecker_ci_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if woodpecker_ci is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/woodpecker-ci/tasks/main.yml b/roles/woodpecker-ci/tasks/main.yml
index 8e9d2270..9b0dbb86 100644
--- a/roles/woodpecker-ci/tasks/main.yml
+++ b/roles/woodpecker-ci/tasks/main.yml
@@ -1,70 +1,84 @@
---
-- name: Check for Gitea installation
- fail:
- msg: "Woodpecker-CI requires Gitea enabled and running for authentication, please set that up first."
- when: gitea_enabled is false
+- name: Start Woodpecker-CI
+ block:
+ - name: Check for Gitea installation
+ ansible.builtin.fail:
+ msg: "Woodpecker-CI requires Gitea enabled and running for authentication, please set that up first."
+ when: gitea_enabled is false
-- name: Check for Gitea config
- fail:
- msg: "Missing Gitea Oauth2 config! Read https://woodpecker-ci.org/docs/administration/forges/gitea and set woodpecker_ci_gitea_client and woodpecker_ci_gitea_secret."
- when: woodpecker_ci_gitea_client == "notset"
+ - name: Check for Gitea config
+ ansible.builtin.fail:
+ msg: "Missing Gitea Oauth2 config! Read https://woodpecker-ci.org/docs/administration/forges/gitea and set woodpecker_ci_gitea_client and woodpecker_ci_gitea_secret."
+ when: woodpecker_ci_gitea_client == "notset"
-- name: Create Woodpecker-CI Directories
- file:
- path: "{{ item }}"
- state: directory
- with_items:
- - "{{ woodpecker_ci_data_directory }}"
+ - name: Create Woodpecker-CI Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ woodpecker_ci_data_directory }}"
-- name: Create Woodpecker-CI container
- docker_container:
- name: woodpecker-ci
- image: woodpeckerci/woodpecker-server:latest
- pull: true
- volumes:
- - "{{ woodpecker_ci_data_directory }}:/var/lib/woodpecker:rw"
- ports:
- - "{{ woodpecker_ci_port_ui }}:8000"
- - "{{ woodpecker_ci_port_grpc }}:9000"
- env:
- WOODPECKER_ADMIN: "{{ woodpecker_ci_admin_user }}"
- WOODPECKER_OPEN: "true"
- WOODPECKER_HOST: "{{ woodpecker_ci_address }}"
- WOODPECKER_AGENT_SECRET: "{{ woodpecker_ci_agent_secret }}"
- WOODPECKER_GITEA: "true"
- WOODPECKER_GITEA_URL: "{{ woodpecker_ci_gitea_url }}"
- WOODPECKER_GITEA_CLIENT: "{{ woodpecker_ci_gitea_client }}"
- WOODPECKER_GITEA_SECRET: "{{ woodpecker_ci_gitea_secret }}"
- WOODPECKER_LOG_LEVEL: "{{ woodpecker_ci_log_level }}"
- restart_policy: unless-stopped
- memory: "{{ woodpecker_ci_memory }}"
- labels:
- traefik.enable: "{{ woodpecker_ci_available_externally | string }}"
- traefik.http.routers.woodpecker_ci.rule: "Host(`{{ woodpecker_ci_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.woodpecker_ci.tls.certresolver: "letsencrypt"
- traefik.http.routers.woodpecker_ci.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.woodpecker_ci.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.woodpecker_ci.loadbalancer.server.port: "8000"
+ - name: Create Woodpecker-CI container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ woodpecker_ci_container_name }}"
+ image: "{{ woodpecker_ci_image_name }}:{{ woodpecker_ci_image_version }}"
+ pull: true
+ volumes:
+ - "{{ woodpecker_ci_data_directory }}:/var/lib/woodpecker:rw"
+ ports:
+ - "{{ woodpecker_ci_port_ui }}:8000"
+ - "{{ woodpecker_ci_port_grpc }}:9000"
+ env:
+ WOODPECKER_ADMIN: "{{ woodpecker_ci_admin_user }}"
+ WOODPECKER_OPEN: "true"
+ WOODPECKER_HOST: "{{ woodpecker_ci_address }}"
+ WOODPECKER_AGENT_SECRET: "{{ woodpecker_ci_agent_secret }}"
+ WOODPECKER_GITEA: "true"
+ WOODPECKER_GITEA_URL: "{{ woodpecker_ci_gitea_url }}"
+ WOODPECKER_GITEA_CLIENT: "{{ woodpecker_ci_gitea_client }}"
+ WOODPECKER_GITEA_SECRET: "{{ woodpecker_ci_gitea_secret }}"
+ WOODPECKER_LOG_LEVEL: "{{ woodpecker_ci_log_level }}"
+ restart_policy: unless-stopped
+ memory: "{{ woodpecker_ci_memory }}"
+ labels:
+ traefik.enable: "{{ woodpecker_ci_available_externally | string }}"
+ traefik.http.routers.woodpecker_ci.rule: "Host(`{{ woodpecker_ci_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.woodpecker_ci.tls.certresolver: "letsencrypt"
+ traefik.http.routers.woodpecker_ci.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.woodpecker_ci.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.woodpecker_ci.loadbalancer.server.port: "8000"
-- name: Create Woodpecker-CI agent container
- docker_container:
- name: woodpecker-ci-agent
- image: woodpeckerci/woodpecker-agent:latest
- pull: true
- volumes:
- - "/var/run/docker.sock:/var/run/docker.sock:rw"
- env:
- WOODPECKER_SERVER: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ woodpecker_ci_port_grpc }}"
- WOODPECKER_AGENT_SECRET: "{{ woodpecker_ci_agent_secret }}"
- WOODPECKER_LOG_LEVEL: "{{ woodpecker_ci_log_level }}"
- restart_policy: unless-stopped
- memory: "{{ woodpecker_ci_agent_memory }}"
+ - name: Create Woodpecker-CI agent container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ woodpecker_ci_agent_container_name }}"
+ image: "{{ woodpecker_ci_agent_image_name }}:{{ woodpecker_ci_agent_image_version }}"
+ pull: true
+ volumes:
+ - "/var/run/docker.sock:/var/run/docker.sock:rw"
+ env:
+ WOODPECKER_SERVER: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:{{ woodpecker_ci_port_grpc }}"
+ WOODPECKER_AGENT_SECRET: "{{ woodpecker_ci_agent_secret }}"
+ WOODPECKER_LOG_LEVEL: "{{ woodpecker_ci_log_level }}"
+ restart_policy: unless-stopped
+ memory: "{{ woodpecker_ci_agent_memory }}"
-- name: Add webhook allowed hosts to Gitea
- blockinfile:
- path: "{{ gitea_data_directory }}/gitea/gitea/conf/app.ini"
- block: |
- [webhook]
- ALLOWED_HOST_LIST=private
- SKIP_TLS_VERIFY=true
- notify: restart gitea
+ - name: Add webhook allowed hosts to Gitea
+ ansible.builtin.blockinfile:
+ path: "{{ gitea_data_directory }}/gitea/gitea/conf/app.ini"
+ block: |
+ [webhook]
+ ALLOWED_HOST_LIST=private
+ SKIP_TLS_VERIFY=true
+ notify: restart
+ tags: molecule-notest
+ when: woodpecker_ci_enabled is true
+
+- name: Stop Woodpecker-CI
+ block:
+ - name: Stop Woodpecker-CI
+ community.docker.docker_container:
+ name: "{{ woodpecker_ci_container_name }}"
+ state: absent
+ when: woodpecker_ci_enabled is false
diff --git a/roles/youtubedlmaterial/defaults/main.yml b/roles/youtubedlmaterial/defaults/main.yml
index d62a73b0..bb1fe73c 100644
--- a/roles/youtubedlmaterial/defaults/main.yml
+++ b/roles/youtubedlmaterial/defaults/main.yml
@@ -13,5 +13,10 @@ youtubedlmaterial_dl_subscriptions_directory: "{{ downloads_root }}/youtube/subs
youtubedlmaterial_hostname: "youtubedlmaterial"
youtubedlmaterial_port_http: "8998"
+# docker
+youtubedlmaterial_container_name: "youtubedlmaterial"
+youtubedlmaterial_image_name: "tzahi12345/youtubedl-material"
+youtubedlmaterial_image_version: "latest"
+
# specs
youtubedlmaterial_memory: "1g"
diff --git a/roles/youtubedlmaterial/molecule/default/molecule.yml b/roles/youtubedlmaterial/molecule/default/molecule.yml
new file mode 100644
index 00000000..cc425dbf
--- /dev/null
+++ b/roles/youtubedlmaterial/molecule/default/molecule.yml
@@ -0,0 +1,6 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ youtubedlmaterial_enabled: true
diff --git a/roles/youtubedlmaterial/molecule/default/side_effect.yml b/roles/youtubedlmaterial/molecule/default/side_effect.yml
new file mode 100644
index 00000000..3e097c11
--- /dev/null
+++ b/roles/youtubedlmaterial/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ youtubedlmaterial_enabled: false
diff --git a/roles/youtubedlmaterial/molecule/default/verify.yml b/roles/youtubedlmaterial/molecule/default/verify.yml
new file mode 100644
index 00000000..274e3501
--- /dev/null
+++ b/roles/youtubedlmaterial/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get youtubedlmaterial container state
+ community.docker.docker_container:
+ name: "{{ youtubedlmaterial_container_name }}"
+ register: result
+
+ - name: Check if youtubedlmaterial containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/youtubedlmaterial/molecule/default/verify_stopped.yml b/roles/youtubedlmaterial/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..c033588d
--- /dev/null
+++ b/roles/youtubedlmaterial/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove youtubedlmaterial
+ community.docker.docker_container:
+ name: "{{ youtubedlmaterial_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if youtubedlmaterial is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/youtubedlmaterial/tasks/main.yml b/roles/youtubedlmaterial/tasks/main.yml
index 48a174b0..941838a0 100644
--- a/roles/youtubedlmaterial/tasks/main.yml
+++ b/roles/youtubedlmaterial/tasks/main.yml
@@ -1,40 +1,52 @@
---
-- name: Create Youtubedlmaterial Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ youtubedlmaterial_data_directory }}/appdata"
- - "{{ youtubedlmaterial_data_directory }}/audio"
- - "{{ youtubedlmaterial_data_directory }}/video"
- - "{{ youtubedlmaterial_data_directory }}/subscriptions"
- - "{{ youtubedlmaterial_dl_audio_directory }}"
- - "{{ youtubedlmaterial_dl_video_directory }}"
- - "{{ youtubedlmaterial_dl_subscriptions_directory }}"
+- name: Start Youtubedlmaterial
+ block:
+ - name: Create Youtubedlmaterial Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ youtubedlmaterial_data_directory }}/appdata"
+ - "{{ youtubedlmaterial_data_directory }}/audio"
+ - "{{ youtubedlmaterial_data_directory }}/video"
+ - "{{ youtubedlmaterial_data_directory }}/subscriptions"
+ - "{{ youtubedlmaterial_dl_audio_directory }}"
+ - "{{ youtubedlmaterial_dl_video_directory }}"
+ - "{{ youtubedlmaterial_dl_subscriptions_directory }}"
-- name: Create Youtubedlmaterial Docker Container
- docker_container:
- name: youtubedlmaterial
- image: tzahi12345/youtubedl-material:latest
- pull: true
- volumes:
- - "{{ youtubedlmaterial_data_directory }}/appdata:/app/appdata:rw"
- - "{{ youtubedlmaterial_dl_audio_directory }}:/app/audio:rw"
- - "{{ youtubedlmaterial_dl_video_directory }}:/app/video:rw"
- - "{{ youtubedlmaterial_dl_subscriptions_directory }}:/app/subscriptions:rw"
- network_mode: "bridge"
- ports:
- - "{{ youtubedlmaterial_port_http }}:17442"
- env:
- ALLOW_CONFIG_MUTATIONS: "true"
- TZ: "{{ ansible_nas_timezone }}"
- restart_policy: unless-stopped
- memory: "{{ youtubedlmaterial_memory }}"
- labels:
- traefik.enable: "{{ youtubedlmaterial_available_externally | string }}"
- traefik.http.routers.youtubedlmaterial.rule: "Host(`{{ youtubedlmaterial_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.youtubedlmaterial.tls.certresolver: "letsencrypt"
- traefik.http.routers.youtubedlmaterial.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.youtubedlmaterial.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.youtubedlmaterial.loadbalancer.server.port: "17442"
+ - name: Create Youtubedlmaterial Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ youtubedlmaterial_container_name }}"
+ image: "{{ youtubedlmaterial_image_name }}:{{ youtubedlmaterial_image_version }}"
+ pull: true
+ volumes:
+ - "{{ youtubedlmaterial_data_directory }}/appdata:/app/appdata:rw"
+ - "{{ youtubedlmaterial_dl_audio_directory }}:/app/audio:rw"
+ - "{{ youtubedlmaterial_dl_video_directory }}:/app/video:rw"
+ - "{{ youtubedlmaterial_dl_subscriptions_directory }}:/app/subscriptions:rw"
+ network_mode: "bridge"
+ ports:
+ - "{{ youtubedlmaterial_port_http }}:17442"
+ env:
+ ALLOW_CONFIG_MUTATIONS: "true"
+ TZ: "{{ ansible_nas_timezone }}"
+ restart_policy: unless-stopped
+ memory: "{{ youtubedlmaterial_memory }}"
+ labels:
+ traefik.enable: "{{ youtubedlmaterial_available_externally | string }}"
+ traefik.http.routers.youtubedlmaterial.rule: "Host(`{{ youtubedlmaterial_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.youtubedlmaterial.tls.certresolver: "letsencrypt"
+ traefik.http.routers.youtubedlmaterial.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.youtubedlmaterial.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.youtubedlmaterial.loadbalancer.server.port: "17442"
+ when: youtubedlmaterial_enabled is true
+
+- name: Stop Youtubedlmaterial
+ block:
+ - name: Stop Youtubedlmaterial
+ community.docker.docker_container:
+ name: "{{ youtubedlmaterial_container_name }}"
+ state: absent
+ when: youtubedlmaterial_enabled is false
diff --git a/roles/znc/defaults/main.yml b/roles/znc/defaults/main.yml
index 3c4b5fbf..09666202 100644
--- a/roles/znc/defaults/main.yml
+++ b/roles/znc/defaults/main.yml
@@ -14,5 +14,17 @@ znc_group_id: "0"
znc_hostname: "znc"
znc_port: "6677"
+# docker
+znc_container_name: "znc"
+znc_image_name: "znc"
+znc_image_version: "latest"
+
# specs
znc_memory: "1g"
+
+# znc
+znc_user_password: "password"
+znc_user_nick: "user"
+znc_user_altnick: "user_"
+znc_user_ident: "user"
+znc_user_real_name: "User Name"
diff --git a/roles/znc/molecule/default/molecule.yml b/roles/znc/molecule/default/molecule.yml
new file mode 100644
index 00000000..00edf7f3
--- /dev/null
+++ b/roles/znc/molecule/default/molecule.yml
@@ -0,0 +1,17 @@
+---
+provisioner:
+ inventory:
+ group_vars:
+ all:
+ znc_enabled: true
+ znc_data_directory: "/tmp/znc"
+platforms:
+ - name: instance
+ image: geerlingguy/docker-ubuntu2204-ansible:latest
+ volumes:
+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /tmp:/tmp
+ cgroupns_mode: host
+ privileged: true
+ pre_build_image: true
diff --git a/roles/znc/molecule/default/side_effect.yml b/roles/znc/molecule/default/side_effect.yml
new file mode 100644
index 00000000..267eb126
--- /dev/null
+++ b/roles/znc/molecule/default/side_effect.yml
@@ -0,0 +1,10 @@
+---
+- name: Stop
+ hosts: all
+ become: true
+ tasks:
+ - name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
+ ansible.builtin.include_role:
+ name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
+ vars:
+ znc_enabled: false
diff --git a/roles/znc/molecule/default/verify.yml b/roles/znc/molecule/default/verify.yml
new file mode 100644
index 00000000..8756c954
--- /dev/null
+++ b/roles/znc/molecule/default/verify.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Get znc container state
+ community.docker.docker_container:
+ name: "{{ znc_container_name }}"
+ register: result
+
+ - name: Check if znc containers are running
+ ansible.builtin.assert:
+ that:
+ - result.container['State']['Status'] == "running"
+ - result.container['State']['Restarting'] == false
diff --git a/roles/znc/molecule/default/verify_stopped.yml b/roles/znc/molecule/default/verify_stopped.yml
new file mode 100644
index 00000000..8a5d3ef9
--- /dev/null
+++ b/roles/znc/molecule/default/verify_stopped.yml
@@ -0,0 +1,19 @@
+---
+- name: Verify
+ hosts: all
+ gather_facts: false
+ tasks:
+ - name: Include vars
+ ansible.builtin.include_vars:
+ file: ../../defaults/main.yml
+
+ - name: Try and stop and remove znc
+ community.docker.docker_container:
+ name: "{{ znc_container_name }}"
+ state: absent
+ register: result
+
+ - name: Check if znc is stopped
+ ansible.builtin.assert:
+ that:
+ - not result.changed
diff --git a/roles/znc/tasks/main.yml b/roles/znc/tasks/main.yml
index 9469afd8..08ccec03 100644
--- a/roles/znc/tasks/main.yml
+++ b/roles/znc/tasks/main.yml
@@ -1,31 +1,50 @@
---
-- name: Create ZNC Directories
- file:
- path: "{{ item }}"
- state: directory
- # mode: 0755
- with_items:
- - "{{ znc_data_directory }}"
+- name: Start ZNC
+ block:
+ - name: Create ZNC Directories
+ ansible.builtin.file:
+ path: "{{ item }}"
+ state: directory
+ # mode: 0755
+ with_items:
+ - "{{ znc_data_directory }}"
+ - "{{ znc_data_directory }}/configs"
-- name: Create ZNC Docker Container
- docker_container:
- name: znc
- image: znc
- pull: true
- volumes:
- - "{{ znc_data_directory }}:/znc-data:rw"
- - "/etc/timezone:/etc/timezone:ro"
- ports:
- - "{{ znc_port }}:6677"
- env:
- PUID: "{{ znc_user_id }}"
- PGID: "{{ znc_group_id }}"
- restart_policy: unless-stopped
- memory: "{{ znc_memory }}"
- labels:
- traefik.enable: "{{ znc_available_externally | string }}"
- traefik.http.routers.znc.rule: "Host(`{{ znc_hostname }}.{{ ansible_nas_domain }}`)"
- traefik.http.routers.znc.tls.certresolver: "letsencrypt"
- traefik.http.routers.znc.tls.domains[0].main: "{{ ansible_nas_domain }}"
- traefik.http.routers.znc.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
- traefik.http.services.znc.loadbalancer.server.port: "6677"
+ - name: Template Znc config
+ ansible.builtin.template:
+ src: znc.conf.j2
+ dest: "{{ znc_data_directory }}/configs/znc.conf"
+ register: template_config
+
+ - name: Create ZNC Docker Container
+ community.docker.docker_container:
+ container_default_behavior: no_defaults
+ name: "{{ znc_container_name }}"
+ image: "{{ znc_image_name }}:{{ znc_image_version }}"
+ pull: true
+ volumes:
+ - "{{ znc_data_directory }}:/znc-data:rw"
+ - "/etc/timezone:/etc/timezone:ro"
+ ports:
+ - "{{ znc_port }}:6677"
+ env:
+ PUID: "{{ znc_user_id }}"
+ PGID: "{{ znc_group_id }}"
+ restart_policy: unless-stopped
+ memory: "{{ znc_memory }}"
+ labels:
+ traefik.enable: "{{ znc_available_externally | string }}"
+ traefik.http.routers.znc.rule: "Host(`{{ znc_hostname }}.{{ ansible_nas_domain }}`)"
+ traefik.http.routers.znc.tls.certresolver: "letsencrypt"
+ traefik.http.routers.znc.tls.domains[0].main: "{{ ansible_nas_domain }}"
+ traefik.http.routers.znc.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
+ traefik.http.services.znc.loadbalancer.server.port: "6677"
+ when: znc_enabled is true
+
+- name: Stop ZNC
+ block:
+ - name: Stop ZNC
+ community.docker.docker_container:
+ name: "{{ znc_container_name }}"
+ state: absent
+ when: znc_enabled is false
diff --git a/roles/znc/templates/znc.conf.j2 b/roles/znc/templates/znc.conf.j2
new file mode 100644
index 00000000..edfb74b7
--- /dev/null
+++ b/roles/znc/templates/znc.conf.j2
@@ -0,0 +1,35 @@
+// WARNING
+//
+// Do NOT edit this file while ZNC is running!
+// Use webadmin or *controlpanel instead.
+//
+// Altering this file by hand will forfeit all support.
+//
+// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
+// Also check https://wiki.znc.in/Configuration
+
+Version = 1.8.2
+
+ Port = 6677
+ IPv4 = true
+ IPv6 = true
+ SSL = false
+
+LoadModule = webadmin
+
+
+ Pass = plain#{{ znc_user_password }}
+ Admin = true
+ Nick = {{ znc_user_nick }}
+ AltNick = {{ znc_user_altnick }}
+ Ident = {{ znc_user_ident }}
+ RealName = {{ znc_user_real_name }}
+ LoadModule = chansaver
+ LoadModule = controlpanel
+ LoadModule = webadmin
+
+
+ LoadModule = simple_away
+ Server = chat.freenode.net +6697
+
+