From e253f0a5d0c1c8f6ae74ddc9872b09631f1bf4d5 Mon Sep 17 00:00:00 2001 From: Anarion Date: Thu, 9 Mar 2023 21:47:42 +0100 Subject: [PATCH] Another set: heimdall to overseer --- nas.yml | 17 --- roles/heimdall/docs/heimdall.md | 15 +++ roles/homeassistant/defaults/main.yml | 5 + roles/homeassistant/docs/homeassistant.md | 13 ++ .../molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ .../homeassistant/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/homeassistant/tasks/main.yml | 62 +++++---- roles/homebridge/defaults/main.yml | 5 + roles/homebridge/docs/homebridge.md | 11 ++ .../homebridge/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/homebridge/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/homebridge/tasks/main.yml | 72 ++++++----- roles/jackett/defaults/main.yml | 5 + roles/jackett/docs/jackett.md | 11 ++ roles/jackett/molecule/default/molecule.yml | 6 + .../jackett/molecule/default/side_effect.yml | 10 ++ roles/jackett/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/jackett/tasks/main.yml | 66 ++++++---- roles/jellyfin/defaults/main.yml | 5 + roles/jellyfin/docs/jellyfin.md | 65 ++++++++++ roles/jellyfin/molecule/default/molecule.yml | 6 + .../jellyfin/molecule/default/side_effect.yml | 10 ++ roles/jellyfin/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/jellyfin/tasks/main.yml | 82 ++++++------ roles/joomla/defaults/main.yml | 10 ++ roles/joomla/docs/joomla.md | 23 ++++ roles/joomla/molecule/default/molecule.yml | 6 + roles/joomla/molecule/default/side_effect.yml | 10 ++ roles/joomla/molecule/default/verify.yml | 26 ++++ .../molecule/default/verify_stopped.yml | 26 ++++ roles/joomla/tasks/main.yml | 113 ++++++++++------- roles/komga/defaults/main.yml | 5 + roles/komga/docs/komga.md | 13 ++ roles/komga/molecule/default/molecule.yml | 6 + roles/komga/molecule/default/side_effect.yml | 10 ++ roles/komga/molecule/default/verify.yml | 19 +++ .../komga/molecule/default/verify_stopped.yml | 19 +++ roles/komga/tasks/main.yml | 80 +++++++----- roles/krusader/defaults/main.yml | 5 + roles/krusader/docs/krusader.md | 13 ++ roles/krusader/molecule/default/molecule.yml | 6 + .../krusader/molecule/default/side_effect.yml | 10 ++ roles/krusader/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/krusader/tasks/main.yml | 76 ++++++----- roles/lidarr/defaults/main.yml | 5 + roles/lidarr/docs/lidarr.md | 9 ++ roles/lidarr/molecule/default/molecule.yml | 6 + roles/lidarr/molecule/default/side_effect.yml | 10 ++ roles/lidarr/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/lidarr/tasks/main.yml | 68 +++++----- roles/mealie/defaults/main.yml | 5 + roles/mealie/docs/mealie.md | 11 ++ roles/mealie/molecule/default/molecule.yml | 6 + roles/mealie/molecule/default/side_effect.yml | 10 ++ roles/mealie/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/mealie/tasks/main.yml | 83 ++++++------ roles/minecraft-server/defaults/main.yml | 5 + .../minecraft-server/docs/minecraft-server.md | 13 ++ .../molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ .../molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/minecraft-server/tasks/main.yml | 48 ++++--- roles/minidlna/defaults/main.yml | 5 + roles/minidlna/docs/minidlna.md | 11 ++ roles/minidlna/molecule/default/molecule.yml | 7 ++ .../minidlna/molecule/default/side_effect.yml | 10 ++ roles/minidlna/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/minidlna/tasks/main.yml | 44 ++++--- roles/miniflux/defaults/main.yml | 8 ++ roles/miniflux/docs/miniflux.md | 15 +++ roles/miniflux/molecule/default/molecule.yml | 6 + .../miniflux/molecule/default/side_effect.yml | 10 ++ roles/miniflux/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/miniflux/tasks/main.yml | 97 +++++++------- roles/mosquitto/defaults/main.yml | 5 + roles/mosquitto/docs/mosquitto.md | 9 ++ roles/mosquitto/molecule/default/molecule.yml | 16 +++ .../molecule/default/side_effect.yml | 10 ++ roles/mosquitto/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/mosquitto/tasks/main.yml | 68 +++++----- roles/mylar/defaults/main.yml | 5 + roles/mylar/docs/mylar.md | 15 +++ roles/mylar/molecule/default/molecule.yml | 6 + roles/mylar/molecule/default/side_effect.yml | 10 ++ roles/mylar/molecule/default/verify.yml | 19 +++ .../mylar/molecule/default/verify_stopped.yml | 19 +++ roles/mylar/tasks/main.yml | 76 ++++++----- roles/mymediaforalexa/defaults/main.yml | 5 + roles/mymediaforalexa/docs/mymediaforalexa.md | 11 ++ .../molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ .../molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/mymediaforalexa/tasks/main.yml | 48 ++++--- roles/n8n/defaults/main.yml | 5 + roles/n8n/docs/n8n.md | 18 +++ roles/n8n/molecule/default/molecule.yml | 6 + roles/n8n/molecule/default/side_effect.yml | 10 ++ roles/n8n/molecule/default/verify.yml | 19 +++ roles/n8n/molecule/default/verify_stopped.yml | 19 +++ roles/n8n/tasks/main.yml | 70 ++++++----- roles/navidrome/defaults/main.yml | 5 + roles/navidrome/docs/navidrome.md | 11 ++ roles/navidrome/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/navidrome/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/navidrome/tasks/main.yml | 78 +++++++----- roles/netbootxyz/defaults/main.yml | 5 +- roles/netbootxyz/docs/netbootxyz.md | 15 +++ .../netbootxyz/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/netbootxyz/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/netbootxyz/tasks/main.yml | 76 ++++++----- roles/netdata/defaults/main.yml | 5 + roles/netdata/docs/netdata.md | 11 ++ roles/netdata/molecule/default/molecule.yml | 7 ++ .../netdata/molecule/default/side_effect.yml | 10 ++ roles/netdata/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/netdata/tasks/main.yml | 76 ++++++----- roles/nextcloud/defaults/main.yml | 15 ++- roles/nextcloud/docs/nextcloud.md | 25 ++++ roles/nextcloud/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/nextcloud/molecule/default/verify.yml | 26 ++++ .../molecule/default/verify_stopped.yml | 26 ++++ roles/nextcloud/tasks/main.yml | 119 +++++++++++------- roles/nomad/docs/nomad.md | 11 ++ roles/nomad/molecule/default/molecule.yml | 16 +++ roles/nomad/molecule/default/side_effect.yml | 10 ++ roles/nomad/molecule/default/verify.yml | 21 ++++ .../nomad/molecule/default/verify_stopped.yml | 18 +++ roles/nomad/tasks/main.yml | 12 +- roles/nzbget/defaults/main.yml | 5 + roles/nzbget/docs/nzbget.md | 11 ++ roles/nzbget/molecule/default/molecule.yml | 6 + roles/nzbget/molecule/default/side_effect.yml | 10 ++ roles/nzbget/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/nzbget/tasks/main.yml | 70 ++++++----- roles/octoprint/defaults/main.yml | 5 + roles/octoprint/docs/octoprint.md | 11 ++ roles/octoprint/molecule/default/molecule.yml | 19 +++ .../molecule/default/side_effect.yml | 10 ++ roles/octoprint/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/octoprint/tasks/main.yml | 74 ++++++----- roles/ombi/defaults/main.yml | 5 +- roles/ombi/docs/ombi.md | 9 ++ roles/ombi/molecule/default/molecule.yml | 6 + roles/ombi/molecule/default/side_effect.yml | 10 ++ roles/ombi/molecule/default/verify.yml | 19 +++ .../ombi/molecule/default/verify_stopped.yml | 19 +++ roles/ombi/tasks/main.yml | 64 ++++++---- roles/openhab/defaults/main.yml | 5 + roles/openhab/docs/openhab.md | 15 +++ roles/openhab/molecule/default/molecule.yml | 6 + .../openhab/molecule/default/side_effect.yml | 10 ++ roles/openhab/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/openhab/tasks/main.yml | 110 ++++++++-------- roles/organizr/defaults/main.yml | 5 +- roles/organizr/docs/organizr.md | 15 +++ roles/organizr/molecule/default/molecule.yml | 6 + .../organizr/molecule/default/side_effect.yml | 10 ++ roles/organizr/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/organizr/tasks/main.yml | 70 ++++++----- roles/overseerr/defaults/main.yml | 5 +- roles/overseerr/docs/overseerr.md | 13 ++ roles/overseerr/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/overseerr/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/overseerr/tasks/main.yml | 70 ++++++----- roles/paperless_ng/docs/trilium.md | 11 ++ .../molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ .../paperless_ng/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/piwigo/docs/trilium.md | 11 ++ roles/piwigo/molecule/default/molecule.yml | 6 + roles/piwigo/molecule/default/side_effect.yml | 10 ++ roles/piwigo/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ roles/plex/docs/trilium.md | 11 ++ roles/plex/molecule/default/molecule.yml | 6 + roles/plex/molecule/default/side_effect.yml | 10 ++ roles/plex/molecule/default/verify.yml | 19 +++ .../plex/molecule/default/verify_stopped.yml | 19 +++ roles/portainer/docs/trilium.md | 11 ++ roles/portainer/molecule/default/molecule.yml | 6 + .../molecule/default/side_effect.yml | 10 ++ roles/portainer/molecule/default/verify.yml | 19 +++ .../molecule/default/verify_stopped.yml | 19 +++ 210 files changed, 3504 insertions(+), 838 deletions(-) create mode 100644 roles/heimdall/docs/heimdall.md create mode 100644 roles/homeassistant/docs/homeassistant.md create mode 100644 roles/homeassistant/molecule/default/molecule.yml create mode 100644 roles/homeassistant/molecule/default/side_effect.yml create mode 100644 roles/homeassistant/molecule/default/verify.yml create mode 100644 roles/homeassistant/molecule/default/verify_stopped.yml create mode 100644 roles/homebridge/docs/homebridge.md create mode 100644 roles/homebridge/molecule/default/molecule.yml create mode 100644 roles/homebridge/molecule/default/side_effect.yml create mode 100644 roles/homebridge/molecule/default/verify.yml create mode 100644 roles/homebridge/molecule/default/verify_stopped.yml create mode 100644 roles/jackett/docs/jackett.md create mode 100644 roles/jackett/molecule/default/molecule.yml create mode 100644 roles/jackett/molecule/default/side_effect.yml create mode 100644 roles/jackett/molecule/default/verify.yml create mode 100644 roles/jackett/molecule/default/verify_stopped.yml create mode 100644 roles/jellyfin/docs/jellyfin.md create mode 100644 roles/jellyfin/molecule/default/molecule.yml create mode 100644 roles/jellyfin/molecule/default/side_effect.yml create mode 100644 roles/jellyfin/molecule/default/verify.yml create mode 100644 roles/jellyfin/molecule/default/verify_stopped.yml create mode 100644 roles/joomla/docs/joomla.md create mode 100644 roles/joomla/molecule/default/molecule.yml create mode 100644 roles/joomla/molecule/default/side_effect.yml create mode 100644 roles/joomla/molecule/default/verify.yml create mode 100644 roles/joomla/molecule/default/verify_stopped.yml create mode 100644 roles/komga/docs/komga.md create mode 100644 roles/komga/molecule/default/molecule.yml create mode 100644 roles/komga/molecule/default/side_effect.yml create mode 100644 roles/komga/molecule/default/verify.yml create mode 100644 roles/komga/molecule/default/verify_stopped.yml create mode 100644 roles/krusader/docs/krusader.md create mode 100644 roles/krusader/molecule/default/molecule.yml create mode 100644 roles/krusader/molecule/default/side_effect.yml create mode 100644 roles/krusader/molecule/default/verify.yml create mode 100644 roles/krusader/molecule/default/verify_stopped.yml create mode 100644 roles/lidarr/docs/lidarr.md create mode 100644 roles/lidarr/molecule/default/molecule.yml create mode 100644 roles/lidarr/molecule/default/side_effect.yml create mode 100644 roles/lidarr/molecule/default/verify.yml create mode 100644 roles/lidarr/molecule/default/verify_stopped.yml create mode 100644 roles/mealie/docs/mealie.md create mode 100644 roles/mealie/molecule/default/molecule.yml create mode 100644 roles/mealie/molecule/default/side_effect.yml create mode 100644 roles/mealie/molecule/default/verify.yml create mode 100644 roles/mealie/molecule/default/verify_stopped.yml create mode 100644 roles/minecraft-server/docs/minecraft-server.md create mode 100644 roles/minecraft-server/molecule/default/molecule.yml create mode 100644 roles/minecraft-server/molecule/default/side_effect.yml create mode 100644 roles/minecraft-server/molecule/default/verify.yml create mode 100644 roles/minecraft-server/molecule/default/verify_stopped.yml create mode 100644 roles/minidlna/docs/minidlna.md create mode 100644 roles/minidlna/molecule/default/molecule.yml create mode 100644 roles/minidlna/molecule/default/side_effect.yml create mode 100644 roles/minidlna/molecule/default/verify.yml create mode 100644 roles/minidlna/molecule/default/verify_stopped.yml create mode 100644 roles/miniflux/docs/miniflux.md create mode 100644 roles/miniflux/molecule/default/molecule.yml create mode 100644 roles/miniflux/molecule/default/side_effect.yml create mode 100644 roles/miniflux/molecule/default/verify.yml create mode 100644 roles/miniflux/molecule/default/verify_stopped.yml create mode 100644 roles/mosquitto/docs/mosquitto.md create mode 100644 roles/mosquitto/molecule/default/molecule.yml create mode 100644 roles/mosquitto/molecule/default/side_effect.yml create mode 100644 roles/mosquitto/molecule/default/verify.yml create mode 100644 roles/mosquitto/molecule/default/verify_stopped.yml create mode 100644 roles/mylar/docs/mylar.md create mode 100644 roles/mylar/molecule/default/molecule.yml create mode 100644 roles/mylar/molecule/default/side_effect.yml create mode 100644 roles/mylar/molecule/default/verify.yml create mode 100644 roles/mylar/molecule/default/verify_stopped.yml create mode 100644 roles/mymediaforalexa/docs/mymediaforalexa.md create mode 100644 roles/mymediaforalexa/molecule/default/molecule.yml create mode 100644 roles/mymediaforalexa/molecule/default/side_effect.yml create mode 100644 roles/mymediaforalexa/molecule/default/verify.yml create mode 100644 roles/mymediaforalexa/molecule/default/verify_stopped.yml create mode 100644 roles/n8n/docs/n8n.md create mode 100644 roles/n8n/molecule/default/molecule.yml create mode 100644 roles/n8n/molecule/default/side_effect.yml create mode 100644 roles/n8n/molecule/default/verify.yml create mode 100644 roles/n8n/molecule/default/verify_stopped.yml create mode 100644 roles/navidrome/docs/navidrome.md create mode 100644 roles/navidrome/molecule/default/molecule.yml create mode 100644 roles/navidrome/molecule/default/side_effect.yml create mode 100644 roles/navidrome/molecule/default/verify.yml create mode 100644 roles/navidrome/molecule/default/verify_stopped.yml create mode 100644 roles/netbootxyz/docs/netbootxyz.md create mode 100644 roles/netbootxyz/molecule/default/molecule.yml create mode 100644 roles/netbootxyz/molecule/default/side_effect.yml create mode 100644 roles/netbootxyz/molecule/default/verify.yml create mode 100644 roles/netbootxyz/molecule/default/verify_stopped.yml create mode 100644 roles/netdata/docs/netdata.md create mode 100644 roles/netdata/molecule/default/molecule.yml create mode 100644 roles/netdata/molecule/default/side_effect.yml create mode 100644 roles/netdata/molecule/default/verify.yml create mode 100644 roles/netdata/molecule/default/verify_stopped.yml create mode 100644 roles/nextcloud/docs/nextcloud.md create mode 100644 roles/nextcloud/molecule/default/molecule.yml create mode 100644 roles/nextcloud/molecule/default/side_effect.yml create mode 100644 roles/nextcloud/molecule/default/verify.yml create mode 100644 roles/nextcloud/molecule/default/verify_stopped.yml create mode 100644 roles/nomad/docs/nomad.md create mode 100644 roles/nomad/molecule/default/molecule.yml create mode 100644 roles/nomad/molecule/default/side_effect.yml create mode 100644 roles/nomad/molecule/default/verify.yml create mode 100644 roles/nomad/molecule/default/verify_stopped.yml create mode 100644 roles/nzbget/docs/nzbget.md create mode 100644 roles/nzbget/molecule/default/molecule.yml create mode 100644 roles/nzbget/molecule/default/side_effect.yml create mode 100644 roles/nzbget/molecule/default/verify.yml create mode 100644 roles/nzbget/molecule/default/verify_stopped.yml create mode 100644 roles/octoprint/docs/octoprint.md create mode 100644 roles/octoprint/molecule/default/molecule.yml create mode 100644 roles/octoprint/molecule/default/side_effect.yml create mode 100644 roles/octoprint/molecule/default/verify.yml create mode 100644 roles/octoprint/molecule/default/verify_stopped.yml create mode 100644 roles/ombi/docs/ombi.md create mode 100644 roles/ombi/molecule/default/molecule.yml create mode 100644 roles/ombi/molecule/default/side_effect.yml create mode 100644 roles/ombi/molecule/default/verify.yml create mode 100644 roles/ombi/molecule/default/verify_stopped.yml create mode 100644 roles/openhab/docs/openhab.md create mode 100644 roles/openhab/molecule/default/molecule.yml create mode 100644 roles/openhab/molecule/default/side_effect.yml create mode 100644 roles/openhab/molecule/default/verify.yml create mode 100644 roles/openhab/molecule/default/verify_stopped.yml create mode 100644 roles/organizr/docs/organizr.md create mode 100644 roles/organizr/molecule/default/molecule.yml create mode 100644 roles/organizr/molecule/default/side_effect.yml create mode 100644 roles/organizr/molecule/default/verify.yml create mode 100644 roles/organizr/molecule/default/verify_stopped.yml create mode 100644 roles/overseerr/docs/overseerr.md create mode 100644 roles/overseerr/molecule/default/molecule.yml create mode 100644 roles/overseerr/molecule/default/side_effect.yml create mode 100644 roles/overseerr/molecule/default/verify.yml create mode 100644 roles/overseerr/molecule/default/verify_stopped.yml create mode 100644 roles/paperless_ng/docs/trilium.md create mode 100644 roles/paperless_ng/molecule/default/molecule.yml create mode 100644 roles/paperless_ng/molecule/default/side_effect.yml create mode 100644 roles/paperless_ng/molecule/default/verify.yml create mode 100644 roles/paperless_ng/molecule/default/verify_stopped.yml create mode 100644 roles/piwigo/docs/trilium.md create mode 100644 roles/piwigo/molecule/default/molecule.yml create mode 100644 roles/piwigo/molecule/default/side_effect.yml create mode 100644 roles/piwigo/molecule/default/verify.yml create mode 100644 roles/piwigo/molecule/default/verify_stopped.yml create mode 100644 roles/plex/docs/trilium.md create mode 100644 roles/plex/molecule/default/molecule.yml create mode 100644 roles/plex/molecule/default/side_effect.yml create mode 100644 roles/plex/molecule/default/verify.yml create mode 100644 roles/plex/molecule/default/verify_stopped.yml create mode 100644 roles/portainer/docs/trilium.md create mode 100644 roles/portainer/molecule/default/molecule.yml create mode 100644 roles/portainer/molecule/default/side_effect.yml create mode 100644 roles/portainer/molecule/default/verify.yml create mode 100644 roles/portainer/molecule/default/verify_stopped.yml diff --git a/nas.yml b/nas.yml index bf2eff18..a4d2e434 100644 --- a/nas.yml +++ b/nas.yml @@ -148,7 +148,6 @@ - role: heimdall tags: - heimdall - when: (heimdall_enabled | default(False)) - role: hello_world tags: @@ -157,82 +156,66 @@ - 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: 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: diff --git a/roles/heimdall/docs/heimdall.md b/roles/heimdall/docs/heimdall.md new file mode 100644 index 00000000..ff2417dd --- /dev/null +++ b/roles/heimdall/docs/heimdall.md @@ -0,0 +1,15 @@ +# Heimdall + +Homepage: + +Heimdall Application Dashboard is a dashboard for all your web applications. It doesn't need to be limited to applications though, you can add links to anything you like + +## Usage + +Set `heimdall_enabled: true` in your `inventories//nas.yml` file. + +The Heimdall web interface can be found at . + +## Specific Configuration + +Heimdall defaults to port 10080 - some browsers block this port. Override `heimdall_port_http` to move it somewhere else. 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/docs/homeassistant.md b/roles/homeassistant/docs/homeassistant.md new file mode 100644 index 00000000..f7163cb2 --- /dev/null +++ b/roles/homeassistant/docs/homeassistant.md @@ -0,0 +1,13 @@ +# Home Assistant + +Homepage: + +Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. + +## Usage + +Set `homeassistant_enabled: true` in your `inventories//nas.yml` file. + +If you want to access Home Assistant externally, don't forget to set `homeassistant_available_externally: true` in your `inventories//nas.yml` file. + +The Home Assistant web interface can be found at . 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/docs/homebridge.md b/roles/homebridge/docs/homebridge.md new file mode 100644 index 00000000..cbb9b329 --- /dev/null +++ b/roles/homebridge/docs/homebridge.md @@ -0,0 +1,11 @@ +# Homebridge + +Homepage: + +Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices. + +## Usage + +Set `homebridge_enabled: true` in your `inventories//nas.yml` file. + +The Homebridge web interface can be found at . The default username and password is 'admin' - change this after your first login! 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/docs/jackett.md b/roles/jackett/docs/jackett.md new file mode 100644 index 00000000..919d8daa --- /dev/null +++ b/roles/jackett/docs/jackett.md @@ -0,0 +1,11 @@ +# Jackett + +Homepage: + +Jackett works as a proxy server: it translates queries from apps (Sonarr, Radarr, SickRage, CouchPotato, Mylar, DuckieTV, qBittorrent, Nefarious etc) into tracker-site-specific http queries, parses the html response, then sends results back to the requesting software. This allows for getting recent uploads (like RSS) and performing searches. Jackett is a single repository of maintained indexer scraping & translation logic - removing the burden from other apps. + +## Usage + +Set `jackett_enabled: true` in your `inventories//nas.yml` file. + +The Jackett web interface can be found at . 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/docs/jellyfin.md b/roles/jellyfin/docs/jellyfin.md new file mode 100644 index 00000000..dfe89533 --- /dev/null +++ b/roles/jellyfin/docs/jellyfin.md @@ -0,0 +1,65 @@ +# Jellyfin + +Homepage: + +Jellyfin is a Free Software Media System that puts you in control of managing and streaming your media. It is an alternative to the proprietary Emby and Plex, to provide media from a dedicated server to end-user devices via multiple apps. Jellyfin is descended from Emby's 3.5.2 release and ported to the .NET Core framework to enable full cross-platform support. There are no strings attached, no premium licenses or features, and no hidden agendas: just a team who want to build something better and work together to achieve it. We welcome anyone who is interested in joining us in our quest! + +Note that [Plex](https://www.plex.tv/), also included in Ansible-NAS, has a very +similar functionality. + +## Usage + +Set `jellyfin_enabled: true` in your `inventories//nas.yml` file. There are further +parameters you can edit such as `movies_root`, `tv_root` or `music_root` lower down + +## Specific Configuration + +The jellyfin web interface can be found at port 8896 (http) or 8928 (https, if +configured) of your NAS. + +By default, Ansible-NAS gives jellyfin read/write access to the folders where your +movies, TV shows and music are stored. To change this to read-only, edit the following +lines in `all.yml`: + +```yaml + jellyfin_movies_permissions: "rw" + jellyfin_tv_permissions: "rw" + jellyfin_books_permissions: "rw" + jellyfin_audiobooks_permissions: "rw" + jellyfin_music_permissions: "rw" +``` + +so that they end in `ro` instead of `rw`. Note that jellyfin will not be able to +delete files then, which might be exactly what you want. However, you will not +have the option to store cover art in the related folders. Always leave the +configuration directory read/write + +## Naming movies and TV shows + +jellyfin is very fussy about how movies and TV shows must be named to enable +automatic downloads of cover art and metadata. In short, movie files should +follow how movies are listed in the [IMDb](https://www.imdb.com/), including the +year of publication: + +```raw + movies/Bride of Frankenstein (1935).mp4 +``` + +Note the spaces. You should probably remove colons and other special characters +TV shows require a folder structure with the name of the series - again if +possible with the year of publication - followed by sub-folders for the +individual seasons. For example, the first episode of the first season of +the original "Doctor Who" could be stored as: + +```raw + tv/Doctor Who (1963)/Season 1/Doctor Who - s01e01.mp4 +``` + +The [TVDB](https://www.thetvdb.com/) is one source for the exact names of TV +shows. + +Unfortunately, there are number of special cases, especially related to split +movies and older series. See the [movie +naming](https://github.com/MediaBrowser/Wiki/wiki/Movie%20naming) and [TV +naming](https://github.com/MediaBrowser/Wiki/wiki/TV-naming) guides for further +information. 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/docs/joomla.md b/roles/joomla/docs/joomla.md new file mode 100644 index 00000000..e0ad95a4 --- /dev/null +++ b/roles/joomla/docs/joomla.md @@ -0,0 +1,23 @@ +# Joomla + +Homepage: + +Joomla! is an award-winning content management system (CMS), which enables you to build web sites and powerful online applications. + +## Usage + +Set `joomla_enabled: true` in your `inventories//nas.yml` file. + +If you want to access Joomla externally, set `joomla_available_externally: true` in your `inventories//nas.yml` file. + +The Joomla web interface can be found at . + +## Specific Configuration + +- Set `joomla_database_password` in your `all.yml` before installing Joomla. + +- On first run you'll need to enter database details: + - Host: `mysql` + - Database: `joomla` + - Username: `root` + - Password: whatever you set for `joomla_database_password`. 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/docs/komga.md b/roles/komga/docs/komga.md new file mode 100644 index 00000000..3c0b3c7d --- /dev/null +++ b/roles/komga/docs/komga.md @@ -0,0 +1,13 @@ +# Komga + +Homepage: + +Docker Image: + +Komga is a media server for your comics, mangas, BDs and magazines. + +## Usage + +Set `komga_enabled: true` in your `inventories//nas.yml` file. + +Access the webui at by default. 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..c68c4432 100644 --- a/roles/krusader/defaults/main.yml +++ b/roles/krusader/defaults/main.yml @@ -18,5 +18,10 @@ krusader_port_http: "5800" krusader_port_vnc: "5900" krusader_hostname: "krusader" +# docker +krusader_container_name: "krusader" +krusader_image_name: "djaydev/krusader" +krusader_image_version: "latest" + # specs krusader_memory: 1g diff --git a/roles/krusader/docs/krusader.md b/roles/krusader/docs/krusader.md new file mode 100644 index 00000000..fc020a10 --- /dev/null +++ b/roles/krusader/docs/krusader.md @@ -0,0 +1,13 @@ +# Krusader + +Homepage: + +Docker Container: [Krusader](https://hub.docker.com/r/djaydev/krusader) + +Krusader provides twin panel file management for your ansible-nas via browser and VNC. + +## Usage + +Set `krusader_enabled: true` in your `inventories//nas.yml` file. + +The Krusader web interface can be found at . 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..2832fd38 100644 --- a/roles/krusader/tasks/main.yml +++ b/roles/krusader/tasks/main.yml @@ -1,34 +1,46 @@ --- -- 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 + 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" + 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/docs/lidarr.md b/roles/lidarr/docs/lidarr.md new file mode 100644 index 00000000..39564454 --- /dev/null +++ b/roles/lidarr/docs/lidarr.md @@ -0,0 +1,9 @@ +# Lidarr + +Homepage: + +Lidarr is a music collection manager for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new tracks from your favorite artists and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. + +## Usage + +Set `lidarr_enabled: true` in your `inventories//nas.yml` file. 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/docs/mealie.md b/roles/mealie/docs/mealie.md new file mode 100644 index 00000000..6e6a1c26 --- /dev/null +++ b/roles/mealie/docs/mealie.md @@ -0,0 +1,11 @@ +# Mealie + +Homepage: + +A self-hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. + +## Usage + +Set `mealie_enabled: true` in your `inventories//nas.yml` file. + +The Mealie web interface can be found at . 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..9978441c 100644 --- a/roles/mealie/tasks/main.yml +++ b/roles/mealie/tasks/main.yml @@ -1,37 +1,50 @@ --- -- 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 + 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 -- 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" 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/docs/minecraft-server.md b/roles/minecraft-server/docs/minecraft-server.md new file mode 100644 index 00000000..e2ac52f8 --- /dev/null +++ b/roles/minecraft-server/docs/minecraft-server.md @@ -0,0 +1,13 @@ +# Minecraft Server + +Homepage: + +The server version of the game Minecraft, running in a container. "Prepare for an adventure of limitless possibilities as you build, mine, battle mobs, and explore the ever-changing Minecraft landscape." + +## Usage + +Set `minecraft_server_enabled: true` in your `inventories//nas.yml` file. + +The Ansible NAS host or ip address should then be usable as a server within the Minecraft multiplayer game menu. + +The image `itzg/minecraft-server` has [documentation](https://github.com/itzg/docker-minecraft-server/blob/master/README.md) with further details on how to manage the Minecraft server instance. 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/docs/minidlna.md b/roles/minidlna/docs/minidlna.md new file mode 100644 index 00000000..1f030d3d --- /dev/null +++ b/roles/minidlna/docs/minidlna.md @@ -0,0 +1,11 @@ +# MiniDLNA + +Homepage: + +MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP clients. The MiniDNLA daemon serves media files (music, pictures, and video) to clients on a network. Example clients include applications such as Totem and Kodi, and devices such as portable media players, Smartphones, Televisions, and gaming systems (such as PS3 and Xbox 360). + +## Usage + +Set `minidlna_enabled: true` in your `inventories//nas.yml` file. + +The very basic MiniDLNA web interface can be found at . 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..010223fd 100644 --- a/roles/miniflux/defaults/main.yml +++ b/roles/miniflux/defaults/main.yml @@ -14,6 +14,14 @@ miniflux_admin_password: supersecure miniflux_hostname: "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/docs/miniflux.md b/roles/miniflux/docs/miniflux.md new file mode 100644 index 00000000..92890158 --- /dev/null +++ b/roles/miniflux/docs/miniflux.md @@ -0,0 +1,15 @@ +# Miniflux + +Homepage: + +Miniflux is a minimalist and opinionated feed reader. + +## Usage + +Set `miniflux_enabled: true` in your `inventories//nas.yml` file. + +The Miniflux web interface can be found at , the default username is `admin` and password `supersecure`. + +## Specific Configuration + +An admin user will be created with the username and password of `miniflux_admin_username` and `miniflux_admin_password` respectively. These can be found in the Miniflux section within `all.yml.dist`. 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..664813df 100644 --- a/roles/miniflux/tasks/main.yml +++ b/roles/miniflux/tasks/main.yml @@ -1,45 +1,58 @@ --- -- 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 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 + 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 - 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 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 + 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" + 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/docs/mosquitto.md b/roles/mosquitto/docs/mosquitto.md new file mode 100644 index 00000000..4015613e --- /dev/null +++ b/roles/mosquitto/docs/mosquitto.md @@ -0,0 +1,9 @@ +# Mosquitto + +Homepage: + +Mosquitto is a lightweight open source MQTT message broker. + +## Usage + +Set `mosquitto_enabled: true` in your `inventories//nas.yml` file. 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/docs/mylar.md b/roles/mylar/docs/mylar.md new file mode 100644 index 00000000..0ddf2e91 --- /dev/null +++ b/roles/mylar/docs/mylar.md @@ -0,0 +1,15 @@ +# Mylar + +Homepage: + +Docker Container: + +An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents + +## Usage + +Set `mylar_enabled: true` in your `inventories//nas.yml` file. + +If you want to access Mylar externally, don't forget to set `mylar_available_externally: true` in your `inventories//nas.yml` file. + +The Mylar web interface can be found at . 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/docs/mymediaforalexa.md b/roles/mymediaforalexa/docs/mymediaforalexa.md new file mode 100644 index 00000000..174f19d7 --- /dev/null +++ b/roles/mymediaforalexa/docs/mymediaforalexa.md @@ -0,0 +1,11 @@ +# My Media for Alexa + +Homepage: + +My Media lets you stream your music collection to your Amazon Echo or Amazon Dot without having to upload all your music collection to the Cloud. This keeps your music under your control. + +## Usage + +Set `mymediaforalexa_enabled: true` in your `inventories//nas.yml` file. + +The My Media for Alexa web interface can be found at . 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/docs/n8n.md b/roles/n8n/docs/n8n.md new file mode 100644 index 00000000..5f531246 --- /dev/null +++ b/roles/n8n/docs/n8n.md @@ -0,0 +1,18 @@ +# Nodemation (n8n) + +Homepage: + +Extendable workflow automation tool that enables you to connect anything to everything. More pragrmatically, it helps you interconnect API with each other to build your own information / work flows. + +## Usage + +Set `n8n_enabled: true` in your `inventories//nas.yml` file. + +n8n is secured by default, he user and password can be set with: + +```yaml + n8n_basic_auth_user: "" + n8n_basic_auth_password: "" +``` + +The default for these is "n8n_user" and "n8n_change_me" respectively, it is recommended to change these. 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/docs/navidrome.md b/roles/navidrome/docs/navidrome.md new file mode 100644 index 00000000..bd8bb180 --- /dev/null +++ b/roles/navidrome/docs/navidrome.md @@ -0,0 +1,11 @@ +# Navidrome + +Homepage: + +Navidrome is an open source web-based music collection server and streamer that is compatible with Subsonic/Airsonic. It gives you freedom to listen to your music collection from any browser or mobile device. It's like your personal Spotify! + +## Usage + +Set `navidrome_enabled: true` in your `inventories//nas.yml` file. + +The Navidrome web interface can be found at . 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/docs/netbootxyz.md b/roles/netbootxyz/docs/netbootxyz.md new file mode 100644 index 00000000..cff9c1d4 --- /dev/null +++ b/roles/netbootxyz/docs/netbootxyz.md @@ -0,0 +1,15 @@ +# netboot.xyz + +Homepage: + +Docker Container: + +netboot.xyz is a way to PXE boot various operating system installers or utilities from one place within the BIOS without the need of having to go retrieve the media to run the tool. [iPXE](https://ipxe.org/) is used to provide a user friendly menu from within the BIOS that lets you easily choose the operating system you want along with any specific types of versions or bootable flags. + +You can remote attach the ISO to servers, set it up as a rescue option in Grub, or even set up your home network to boot to it by default so that it's always available. + +## Usage + +Set `netbootxyz_enabled: true` in your `inventories//nas.yml` file. + +The netbooxyz web interface can be found at . 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/docs/netdata.md b/roles/netdata/docs/netdata.md new file mode 100644 index 00000000..e8ef6884 --- /dev/null +++ b/roles/netdata/docs/netdata.md @@ -0,0 +1,11 @@ +# Netdata + +Homepage: + +An extremely comprehensive system monitoring solution. + +## Usage + +Set `netdata_enabled: true` in your `inventories//nas.yml` file. + +Netdata web interface can be found at . 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/docs/nextcloud.md b/roles/nextcloud/docs/nextcloud.md new file mode 100644 index 00000000..842839af --- /dev/null +++ b/roles/nextcloud/docs/nextcloud.md @@ -0,0 +1,25 @@ +# Nextcloud + +Homepage: + +## Usage + +Set `nextcloud_enabled: true` in your `inventories//nas.yml` file. + +Tread carefully. + +External access may require that you manually configure your Fully Qualified Domain Name (FQDN) as a trusted domain within the application. There is an environment variable set up for this in the "nextcloud task" which will most likely make manual configuration unnecessary. If you get the following [screenshot](https://docs.nextcloud.com/server/14/admin_manual/installation/installation_wizard.html#trusted-domains) warning when trying to access nextcloud externally you'll need to manually set it up. + +This can be accomplished in two commands. + +```bash +# On the server where the docker containers are running +$ docker exec -it --user www-data nextcloud /bin/bash +$ php occ config:system:set trusted_domains INDEX_FOR_NEW_ENTRY_SEE_DOCS_LINK_BELOW --value=YOUR_FQDN_HERE --update-only +``` + +The above commands are documented in the administration guide for Nextcloud: + +* [set array values](https://docs.nextcloud.com/server/14/admin_manual/configuration_server/occ_command.html#setting-an-array-configuration-value) + +* [docker container docs, references environment variables](https://github.com/nextcloud/docker) 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/docs/nomad.md b/roles/nomad/docs/nomad.md new file mode 100644 index 00000000..17e9569b --- /dev/null +++ b/roles/nomad/docs/nomad.md @@ -0,0 +1,11 @@ +# Nomad + +Homepage: + +A simple and flexible scheduler and orchestrator to deploy and manage containers and non-containerised applications across on-prem and clouds at scale. + +## Usage + +Set `nomad_enabled: true` in your `inventories//nas.yml` file. + +Nomad's web interface can be found at 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..717a7d47 --- /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 + 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..f0ea6b28 100644 --- a/roles/nomad/tasks/main.yml +++ b/roles/nomad/tasks/main.yml @@ -2,13 +2,21 @@ - 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 + # dest: /usr/share/keyrings/hashicorp-nomad-keyring.gpg + mode: '0644' + force: true + # - name: Add Hashicorp GPG key + # ansible.builtin.apt_key: + # url: https://apt.releases.hashicorp.com/gpg + # state: present - name: Add Hashicorp apt repository ansible.builtin.apt_repository: repo: "deb https://apt.releases.hashicorp.com {{ ansible_facts['lsb']['codename'] }} main" + # repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-nomad-keyring.gpg] https://apt.releases.hashicorp.com {{ ansible_facts['lsb']['codename'] }} main" state: present filename: hashicorp 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/docs/nzbget.md b/roles/nzbget/docs/nzbget.md new file mode 100644 index 00000000..a0d82adc --- /dev/null +++ b/roles/nzbget/docs/nzbget.md @@ -0,0 +1,11 @@ +# NZBGet + +Homepage: + +The most efficient Usenet downloader. NZBGet is written in C++ and designed with performance in mind to achieve maximum download speed by using very little system resources. + +## Usage + +Set `nzbget_enabled: true` in your `inventories//nas.yml` file. + +The NZBget web interface can be found at , the default username is `nzbget` and password `tegbzn6789`. Change this once you've logged in! 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/docs/octoprint.md b/roles/octoprint/docs/octoprint.md new file mode 100644 index 00000000..75450645 --- /dev/null +++ b/roles/octoprint/docs/octoprint.md @@ -0,0 +1,11 @@ +# Octoprint + +Homepage: + +Octoprint is a control and monitoring application for your 3D printer. You can start and stop print jobs, view your webcam feed, move the print head and extruder manually and check your gcode files, all from a single web interface. Octoprint doesn't require modifications on the printer firmware, just make sure your NAS is phisically connected to it with a usb cable. + +## Usage + +Connect the printer to your NAS, and take note of where the serial interface is mounted (usually it's automounted in `/dev/ttyUSB0`). Set `octoprint_enabled: true` in your `inventories//nas.yml` file, as well as the `octoprint_printer_mountpoint` variable if your printer doesn't mount to the default location. + +If you want to also have a webcam feed, attach one to your NAS and take note of its mountpoint as well (usually `/dev/video0`). Set `octoprint_enable_webcam: true` and add a `octoprint_webcam_mountpoint` variable if the webcam doesn't mount to the default location. diff --git a/roles/octoprint/molecule/default/molecule.yml b/roles/octoprint/molecule/default/molecule.yml new file mode 100644 index 00000000..7d54b88f --- /dev/null +++ b/roles/octoprint/molecule/default/molecule.yml @@ -0,0 +1,19 @@ +--- +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/docs/ombi.md b/roles/ombi/docs/ombi.md new file mode 100644 index 00000000..e4ba8884 --- /dev/null +++ b/roles/ombi/docs/ombi.md @@ -0,0 +1,9 @@ +# Ombi + +Homepage: + +Ombi is a self-hosted web application that automatically gives your shared Plex or Emby users the ability to request content by themselves! Ombi can be linked to multiple TV Show and Movie DVR tools to create a seamless end-to-end experience for your users. + +## Usage + +Set `ombi_enabled: true` in your `inventories//nas.yml` file. 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/docs/openhab.md b/roles/openhab/docs/openhab.md new file mode 100644 index 00000000..2ea46ddf --- /dev/null +++ b/roles/openhab/docs/openhab.md @@ -0,0 +1,15 @@ +# openHAB + +Homepage: + +OpenHab is a vendor and technology agnostic open source automation software for your home. +It allows you to connect many different IoT-Devices (which in this case means "Intranet of Things") using custom bindings made by the community. + +## Usage + +Set `openhab_enabled: true` in your `inventories//nas.yml` file. + +## Specific Configuration + +The openHAB Webinterface is available at port 7777 (HTTP) and 7778 (HTTPS). +Visit the webinterface and follow the setup instructions found in the [openHAB Documentation](https://www.openhab.org/docs/tutorial/1sttimesetup.html) 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/docs/organizr.md b/roles/organizr/docs/organizr.md new file mode 100644 index 00000000..df1b293f --- /dev/null +++ b/roles/organizr/docs/organizr.md @@ -0,0 +1,15 @@ +# Organizr + +Homepage: + +ORGANIZR aims to be your one stop shop for your Servers Frontend. + +Do you have quite a bit of services running on your computer or server? Do you have a lot of bookmarks or have to memor$ + +TODO: finish this truncated description + +## Usage + +Set `organizr_enabled: true` in your `inventories//nas.yml` file. + +The Organizr web interface can be found at . 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/docs/overseerr.md b/roles/overseerr/docs/overseerr.md new file mode 100644 index 00000000..8a017edb --- /dev/null +++ b/roles/overseerr/docs/overseerr.md @@ -0,0 +1,13 @@ +# Overseerr + + Homepage: + + Docker Container: + + Overseerr is a free and open source software application for managing requests for your media library. It integrates with your existing services, such as Sonarr, Radarr, and Plex! + +## Usage + + Using overseerr: Set `overseerr_enabled: true` in your `inventories//nas.yml` file. + + The overseerr web interface can be found at . 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/docs/trilium.md b/roles/paperless_ng/docs/trilium.md new file mode 100644 index 00000000..333cf7fb --- /dev/null +++ b/roles/paperless_ng/docs/trilium.md @@ -0,0 +1,11 @@ +# Trilium + +Homepage: + +A hierarchical note taking application with focus on building large personal knowledge bases. + +## Usage + +Set `trilium_enabled: true` in your `inventories//nas.yml` file. + +Trilium web interface can be found at . diff --git a/roles/paperless_ng/molecule/default/molecule.yml b/roles/paperless_ng/molecule/default/molecule.yml new file mode 100644 index 00000000..91b053f0 --- /dev/null +++ b/roles/paperless_ng/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + trilium_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..92e03151 --- /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: + trilium_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..9080137d --- /dev/null +++ b/roles/paperless_ng/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 trilium container state + community.docker.docker_container: + name: "{{ trilium_container_name }}" + register: result + + - name: Check if trilium containers are running + ansible.builtin.assert: + that: + - 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..e82fff95 --- /dev/null +++ b/roles/paperless_ng/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 trilium + community.docker.docker_container: + name: "{{ trilium_container_name }}" + state: absent + register: result + + - name: Check if trilium is stopped + ansible.builtin.assert: + that: + - not result.changed diff --git a/roles/piwigo/docs/trilium.md b/roles/piwigo/docs/trilium.md new file mode 100644 index 00000000..333cf7fb --- /dev/null +++ b/roles/piwigo/docs/trilium.md @@ -0,0 +1,11 @@ +# Trilium + +Homepage: + +A hierarchical note taking application with focus on building large personal knowledge bases. + +## Usage + +Set `trilium_enabled: true` in your `inventories//nas.yml` file. + +Trilium web interface can be found at . diff --git a/roles/piwigo/molecule/default/molecule.yml b/roles/piwigo/molecule/default/molecule.yml new file mode 100644 index 00000000..91b053f0 --- /dev/null +++ b/roles/piwigo/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + trilium_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..92e03151 --- /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: + trilium_enabled: false diff --git a/roles/piwigo/molecule/default/verify.yml b/roles/piwigo/molecule/default/verify.yml new file mode 100644 index 00000000..9080137d --- /dev/null +++ b/roles/piwigo/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 trilium container state + community.docker.docker_container: + name: "{{ trilium_container_name }}" + register: result + + - name: Check if trilium containers are running + ansible.builtin.assert: + that: + - result.container['State']['Status'] == "running" + - result.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..e82fff95 --- /dev/null +++ b/roles/piwigo/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 trilium + community.docker.docker_container: + name: "{{ trilium_container_name }}" + state: absent + register: result + + - name: Check if trilium is stopped + ansible.builtin.assert: + that: + - not result.changed diff --git a/roles/plex/docs/trilium.md b/roles/plex/docs/trilium.md new file mode 100644 index 00000000..333cf7fb --- /dev/null +++ b/roles/plex/docs/trilium.md @@ -0,0 +1,11 @@ +# Trilium + +Homepage: + +A hierarchical note taking application with focus on building large personal knowledge bases. + +## Usage + +Set `trilium_enabled: true` in your `inventories//nas.yml` file. + +Trilium web interface can be found at . diff --git a/roles/plex/molecule/default/molecule.yml b/roles/plex/molecule/default/molecule.yml new file mode 100644 index 00000000..91b053f0 --- /dev/null +++ b/roles/plex/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + trilium_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..92e03151 --- /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: + trilium_enabled: false diff --git a/roles/plex/molecule/default/verify.yml b/roles/plex/molecule/default/verify.yml new file mode 100644 index 00000000..9080137d --- /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 trilium container state + community.docker.docker_container: + name: "{{ trilium_container_name }}" + register: result + + - name: Check if trilium 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..e82fff95 --- /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 trilium + community.docker.docker_container: + name: "{{ trilium_container_name }}" + state: absent + register: result + + - name: Check if trilium is stopped + ansible.builtin.assert: + that: + - not result.changed diff --git a/roles/portainer/docs/trilium.md b/roles/portainer/docs/trilium.md new file mode 100644 index 00000000..333cf7fb --- /dev/null +++ b/roles/portainer/docs/trilium.md @@ -0,0 +1,11 @@ +# Trilium + +Homepage: + +A hierarchical note taking application with focus on building large personal knowledge bases. + +## Usage + +Set `trilium_enabled: true` in your `inventories//nas.yml` file. + +Trilium web interface can be found at . diff --git a/roles/portainer/molecule/default/molecule.yml b/roles/portainer/molecule/default/molecule.yml new file mode 100644 index 00000000..91b053f0 --- /dev/null +++ b/roles/portainer/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + trilium_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..92e03151 --- /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: + trilium_enabled: false diff --git a/roles/portainer/molecule/default/verify.yml b/roles/portainer/molecule/default/verify.yml new file mode 100644 index 00000000..9080137d --- /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 trilium container state + community.docker.docker_container: + name: "{{ trilium_container_name }}" + register: result + + - name: Check if trilium 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..e82fff95 --- /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 trilium + community.docker.docker_container: + name: "{{ trilium_container_name }}" + state: absent + register: result + + - name: Check if trilium is stopped + ansible.builtin.assert: + that: + - not result.changed