diff --git a/playbooks/roles/services/datasets/user/tasks/main.yml b/playbooks/roles/services/datasets/user/tasks/main.yml index 09f588c..78ef1df 100644 --- a/playbooks/roles/services/datasets/user/tasks/main.yml +++ b/playbooks/roles/services/datasets/user/tasks/main.yml @@ -26,14 +26,9 @@ extra_zfs_properties: canmount: "off" -- name: "{{ services_service_name }} : include volume list" - ansible.builtin.import_role: - name: "services/include" - vars_from: "volumes" - - name: "{{ services_service_name }} : create volume datasets" community.general.zfs: name: "{{ services_data_dataset }}/{{ services_service_user_name }}/{{ item.key }}" state: "present" extra_zfs_properties: "{{ item.value.extra_zfs_properties | default({}) }}" - loop: "{{ services_volumes[services_service_name] | dict2items }}" + loop: "{{ services_service_volumes | dict2items }}" diff --git a/playbooks/roles/services/deploy/cloud/tasks/main.yml b/playbooks/roles/services/deploy/cloud/tasks/main.yml index a98149a..914e823 100644 --- a/playbooks/roles/services/deploy/cloud/tasks/main.yml +++ b/playbooks/roles/services/deploy/cloud/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - block: - name: "configure nginx" diff --git a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-chown.service b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-chown.service index 115f2a6..e8b67f0 100644 --- a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-chown.service +++ b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-chown.service @@ -21,7 +21,7 @@ ExecStart=/usr/bin/podman run \ --user=0 \ --entrypoint="/bin/bash" \ --name=pod-cloud-chown \ - docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} \ + docker.io/library/nextcloud:{{ services_service_deploy_versions.nextcloud }} \ -c "chown -R www-data:www-data /var/www/html /media/external" ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-chown.ctr-id Type=oneshot diff --git a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-cron.service b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-cron.service index c0672c2..18798c4 100644 --- a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-cron.service +++ b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-cron.service @@ -27,7 +27,7 @@ ExecStart=/usr/bin/podman run \ -v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \ -v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \ --name=pod-cloud-cron \ - docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} \ + docker.io/library/nextcloud:{{ services_service_deploy_versions.nextcloud }} \ /cron.sh ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-cloud-cron.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-cron.ctr-id diff --git a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nextcloud.service b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nextcloud.service index 6751240..896b39d 100644 --- a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nextcloud.service +++ b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nextcloud.service @@ -44,7 +44,7 @@ ExecStart=/usr/bin/podman run \ -e MAIL_FROM_ADDRESS="cloud" \ -e MAIL_DOMAIN="{{ services[services_service_name].domain }}" \ --name=pod-cloud-nextcloud \ - docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} + docker.io/library/nextcloud:{{ services_service_deploy_versions.nextcloud }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-cloud-nextcloud.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-nextcloud.ctr-id PIDFile=%t/container-cloud-nextcloud.pid diff --git a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nginx.service b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nginx.service index 5921aa6..900afdc 100644 --- a/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nginx.service +++ b/playbooks/roles/services/deploy/cloud/templates/systemd/container-cloud-nginx.service @@ -25,7 +25,7 @@ ExecStart=/usr/bin/podman run \ -v {{ services_data_directory }}/pod-cloud/nextcloud/_data:/var/www/html \ -v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \ --name=pod-cloud-nginx \ - docker.io/library/nginx:{{ services_deploy_versions.cloud.nginx }} + docker.io/library/nginx:{{ services_service_deploy_versions.nginx }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-cloud-nginx.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-nginx.ctr-id PIDFile=%t/container-cloud-nginx.pid diff --git a/playbooks/roles/services/deploy/database/tasks/main.yml b/playbooks/roles/services/deploy/database/tasks/main.yml index 9ce8bfc..1a139a7 100644 --- a/playbooks/roles/services/deploy/database/tasks/main.yml +++ b/playbooks/roles/services/deploy/database/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - block: - name: "configure postgres password" diff --git a/playbooks/roles/services/deploy/database/templates/systemd/container-database-postgres.service b/playbooks/roles/services/deploy/database/templates/systemd/container-database-postgres.service index f689aa3..931c6b8 100644 --- a/playbooks/roles/services/deploy/database/templates/systemd/container-database-postgres.service +++ b/playbooks/roles/services/deploy/database/templates/systemd/container-database-postgres.service @@ -27,7 +27,7 @@ ExecStart=/usr/bin/podman run \ -e POSTGRES_INITDB_WALDIR=/var/lib/postgresql-wal \ -v {{ services_data_directory }}/pod-database/data/_data:/var/lib/postgresql/data \ --name=pod-database-postgres \ - docker.io/library/postgres:{{ services_deploy_versions.database.postgres }} + docker.io/library/postgres:{{ services_service_deploy_versions.postgres }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-database-postgres.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-database-postgres.ctr-id PIDFile=%t/container-database-postgres.pid diff --git a/playbooks/roles/services/deploy/git/tasks/main.yml b/playbooks/roles/services/deploy/git/tasks/main.yml index c39144b..db4f6f9 100644 --- a/playbooks/roles/services/deploy/git/tasks/main.yml +++ b/playbooks/roles/services/deploy/git/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - block: - name: "configure systemd service" diff --git a/playbooks/roles/services/deploy/git/templates/systemd/container-git-gitea.service b/playbooks/roles/services/deploy/git/templates/systemd/container-git-gitea.service index 1fd603e..fee5bac 100644 --- a/playbooks/roles/services/deploy/git/templates/systemd/container-git-gitea.service +++ b/playbooks/roles/services/deploy/git/templates/systemd/container-git-gitea.service @@ -46,7 +46,7 @@ ExecStart=/usr/bin/podman run \ -e GITEA__service__DISABLE_REGISTRATION="true" \ -e GITEA__service__ENABLE_NOTIFY_MAIL="true" \ --name=pod-git-gitea \ - docker.io/gitea/gitea:{{ services_deploy_versions.git.gitea }} + docker.io/gitea/gitea:{{ services_service_deploy_versions.gitea }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-git-gitea.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-git-gitea.ctr-id PIDFile=%t/container-git-gitea.pid diff --git a/playbooks/roles/services/deploy/music/tasks/main.yml b/playbooks/roles/services/deploy/music/tasks/main.yml index f388a1a..24c3bc9 100644 --- a/playbooks/roles/services/deploy/music/tasks/main.yml +++ b/playbooks/roles/services/deploy/music/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - block: - name: "configure systemd service" diff --git a/playbooks/roles/services/deploy/music/templates/systemd/container-music-archive.service b/playbooks/roles/services/deploy/music/templates/systemd/container-music-archive.service index 6a35988..05186a1 100644 --- a/playbooks/roles/services/deploy/music/templates/systemd/container-music-archive.service +++ b/playbooks/roles/services/deploy/music/templates/systemd/container-music-archive.service @@ -29,7 +29,7 @@ ExecStart=/usr/bin/podman run \ -e ND_LASTFM_ENABLED="false" \ -e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \ --name=pod-music-archive \ - docker.io/deluan/navidrome:{{ services_deploy_versions.music.navidrome }} + docker.io/deluan/navidrome:{{ services_service_deploy_versions.navidrome }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-music-archive.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-music-archive.ctr-id PIDFile=%t/container-music-archive.pid diff --git a/playbooks/roles/services/deploy/music/templates/systemd/container-music-collection.service b/playbooks/roles/services/deploy/music/templates/systemd/container-music-collection.service index 6374b17..b975c55 100644 --- a/playbooks/roles/services/deploy/music/templates/systemd/container-music-collection.service +++ b/playbooks/roles/services/deploy/music/templates/systemd/container-music-collection.service @@ -29,7 +29,7 @@ ExecStart=/usr/bin/podman run \ -e ND_LASTFM_ENABLED="false" \ -e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \ --name=pod-music-collection \ - docker.io/deluan/navidrome:{{ services_deploy_versions.music.navidrome }} + docker.io/deluan/navidrome:{{ services_service_deploy_versions.navidrome }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-music-collection.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-music-collection.ctr-id PIDFile=%t/container-music-collection.pid diff --git a/playbooks/roles/services/deploy/notes/tasks/main.yml b/playbooks/roles/services/deploy/notes/tasks/main.yml index 2416603..dedd78d 100644 --- a/playbooks/roles/services/deploy/notes/tasks/main.yml +++ b/playbooks/roles/services/deploy/notes/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - block: - name: "configure systemd service" diff --git a/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-chown.service b/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-chown.service index 3cbbee4..c403b92 100644 --- a/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-chown.service +++ b/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-chown.service @@ -19,7 +19,7 @@ ExecStart=/usr/bin/podman run \ --user=0 \ --entrypoint="/bin/bash" \ --name=pod-notes-chown \ - docker.io/joplin/server:{{ services_deploy_versions.notes.joplin }} \ + docker.io/joplin/server:{{ services_service_deploy_versions.joplin }} \ -c "chown -R joplin:joplin /data" ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-notes-chown.ctr-id Type=oneshot diff --git a/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-joplin.service b/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-joplin.service index 4ceb5a5..870250a 100644 --- a/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-joplin.service +++ b/playbooks/roles/services/deploy/notes/templates/systemd/container-notes-joplin.service @@ -42,7 +42,7 @@ ExecStart=/usr/bin/podman run \ -e MAILER_NOREPLY_EMAIL="notes@{{ services[services_service_name].domain }}" \ -e STORAGE_DRIVER="Type=Filesystem; Path=/data" \ --name=pod-notes-joplin \ - docker.io/joplin/server:{{ services_deploy_versions.notes.joplin }} + docker.io/joplin/server:{{ services_service_deploy_versions.joplin }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-notes-joplin.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-notes-joplin.ctr-id PIDFile=%t/container-notes-joplin.pid diff --git a/playbooks/roles/services/deploy/rproxy/tasks/main.yml b/playbooks/roles/services/deploy/rproxy/tasks/main.yml index 82eeab5..c956af3 100644 --- a/playbooks/roles/services/deploy/rproxy/tasks/main.yml +++ b/playbooks/roles/services/deploy/rproxy/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "{{ services_service_name }} : set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - name: "{{ services_service_name }} : set the rproxy variables" ansible.builtin.include_vars: file: "nginx.yml" diff --git a/playbooks/roles/services/deploy/rproxy/templates/systemd/container-rproxy-nginx.service b/playbooks/roles/services/deploy/rproxy/templates/systemd/container-rproxy-nginx.service index e534276..e8a5236 100644 --- a/playbooks/roles/services/deploy/rproxy/templates/systemd/container-rproxy-nginx.service +++ b/playbooks/roles/services/deploy/rproxy/templates/systemd/container-rproxy-nginx.service @@ -30,7 +30,7 @@ ExecStart=/usr/bin/podman run \ -v var-lib-letsencrypt:/var/lib/letsencrypt:ro \ -v var-www-html:/var/www/html \ --name=pod-{{ services_service_name }}-nginx \ - docker.io/library/nginx:{{ services_deploy_versions.www.nginx }} + docker.io/library/nginx:{{ services_service_deploy_versions.nginx }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-{{ services_service_name }}-nginx.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-{{ services_service_name }}-nginx.ctr-id PIDFile=%t/container-{{ services_service_name }}-nginx.pid diff --git a/playbooks/roles/services/deploy/www/tasks/main.yml b/playbooks/roles/services/deploy/www/tasks/main.yml index c775d28..1416f6a 100644 --- a/playbooks/roles/services/deploy/www/tasks/main.yml +++ b/playbooks/roles/services/deploy/www/tasks/main.yml @@ -4,11 +4,6 @@ name: "services/include" vars_from: "user" -- name: "set the version variables" - ansible.builtin.import_role: - name: "services/deploy/include" - vars_from: "versions" - - name: "check if hugo is installed" ansible.builtin.stat: path: "/usr/local/bin/hugo" diff --git a/playbooks/roles/services/deploy/www/templates/systemd/container-www-nginx.service b/playbooks/roles/services/deploy/www/templates/systemd/container-www-nginx.service index 30025b5..637414f 100644 --- a/playbooks/roles/services/deploy/www/templates/systemd/container-www-nginx.service +++ b/playbooks/roles/services/deploy/www/templates/systemd/container-www-nginx.service @@ -24,7 +24,7 @@ ExecStart=/usr/bin/podman run \ -v {{ services_root_directory }}/{{ services_resolv_host }}-resolv.conf:/etc/resolv.conf:ro \ -v ./.config/pod-www/wojciechkozlowski.eu/public:/usr/share/nginx/html:ro \ --name=pod-www-nginx \ - docker.io/library/nginx:{{ services_deploy_versions.www.nginx }} + docker.io/library/nginx:{{ services_service_deploy_versions.nginx }} ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-www-nginx.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-www-nginx.ctr-id PIDFile=%t/container-www-nginx.pid diff --git a/playbooks/roles/services/setup/user/tasks/include/directories.yml b/playbooks/roles/services/setup/user/tasks/include/directories.yml index c6fc4d8..94315a8 100644 --- a/playbooks/roles/services/setup/user/tasks/include/directories.yml +++ b/playbooks/roles/services/setup/user/tasks/include/directories.yml @@ -15,14 +15,9 @@ group: "{{ services_service_user_name }}" mode: 0755 -- name: "{{ services_service_name }} : directories : include volume list" - ansible.builtin.import_role: - name: "services/include" - vars_from: "volumes" - - name: "{{ services_service_name }} : directories : create volume directories" ansible.builtin.include_tasks: "directories/volumes.yml" - loop: "{{ services_volumes[services_service_name] | dict2items }}" + loop: "{{ services_service_volumes | dict2items }}" loop_control: loop_var: "services_service_volume" diff --git a/playbooks/services.yml b/playbooks/services.yml index 0486e6d..6e477ea 100644 --- a/playbooks/services.yml +++ b/playbooks/services.yml @@ -1,6 +1,8 @@ --- - name: "services : asgard:&zfs" hosts: "asgard:&zfs" + vars_files: + - "vars/services/volumes.yml" tasks: - name: "datasets : user" @@ -13,6 +15,8 @@ - "services:datasets:user" - "services:datasets:user:{{ services_service_name }}" - "services:{{ services_service_name }}:datasets:user" + vars: + services_service_volumes: "{{ services_volumes[services_service_name] }}" loop: "{{ services_host_services | dict2items | map(attribute='key') }}" loop_control: loop_var: "services_service_name" @@ -20,6 +24,9 @@ - name: "services : asgard" hosts: "asgard" + vars_files: + - "vars/services/volumes.yml" + - "vars/services/deploy/versions.yml" roles: - role: "services/setup/system" @@ -38,6 +45,8 @@ - "services:setup:user" - "services:setup:user:{{ services_service_name }}" - "services:{{ services_service_name }}:setup:user" + vars: + services_service_volumes: "{{ services_volumes[services_service_name] }}" loop: "{{ services_host_services | dict2items | map(attribute='key') }}" loop_control: loop_var: "services_service_name" @@ -59,6 +68,7 @@ - "files/services/deploy/rproxy/nginx-conf.d/http-default.conf" - "files/services/deploy/rproxy/nginx-conf.d/wojciechkozlowski.eu.conf" - "files/services/deploy/rproxy/nginx-conf.d/www.wojciechkozlowski.eu.conf" + services_service_deploy_versions: "{{ services_deploy_versions.rproxy }}" when: "'rproxy' in services_host_services" tags: "always" @@ -80,6 +90,7 @@ - "files/services/deploy/lrproxy/nginx-conf.d/git.wojciechkozlowski.eu.conf" - "files/services/deploy/lrproxy/nginx-conf.d/music.wojciechkozlowski.eu.conf" - "files/services/deploy/lrproxy/nginx-conf.d/notes.wojciechkozlowski.eu.conf" + services_service_deploy_versions: "{{ services_deploy_versions.lrproxy }}" when: "'lrproxy' in services_host_services" tags: "always" @@ -92,6 +103,8 @@ - "services:deploy" - "services:deploy:{{ services_service_name }}" - "services:{{ services_service_name }}:deploy" + vars: + services_service_deploy_versions: "{{ services_deploy_versions[services_service_name] }}" loop: "{{ services_host_services | dict2items | rejectattr('key', '==', 'rproxy') | diff --git a/playbooks/roles/services/deploy/include/vars/versions.yml b/playbooks/vars/services/deploy/versions.yml similarity index 100% rename from playbooks/roles/services/deploy/include/vars/versions.yml rename to playbooks/vars/services/deploy/versions.yml diff --git a/playbooks/roles/services/include/vars/volumes.yml b/playbooks/vars/services/volumes.yml similarity index 100% rename from playbooks/roles/services/include/vars/volumes.yml rename to playbooks/vars/services/volumes.yml