Remove includes from roles to finalise split

This commit is contained in:
Wojciech Kozlowski 2023-07-17 23:03:33 +02:00
parent 3d8a7aa582
commit fbd8050b56
24 changed files with 27 additions and 59 deletions

View File

@ -26,14 +26,9 @@
extra_zfs_properties: extra_zfs_properties:
canmount: "off" 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" - name: "{{ services_service_name }} : create volume datasets"
community.general.zfs: community.general.zfs:
name: "{{ services_data_dataset }}/{{ services_service_user_name }}/{{ item.key }}" name: "{{ services_data_dataset }}/{{ services_service_user_name }}/{{ item.key }}"
state: "present" state: "present"
extra_zfs_properties: "{{ item.value.extra_zfs_properties | default({}) }}" extra_zfs_properties: "{{ item.value.extra_zfs_properties | default({}) }}"
loop: "{{ services_volumes[services_service_name] | dict2items }}" loop: "{{ services_service_volumes | dict2items }}"

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "services/deploy/include"
vars_from: "versions"
- block: - block:
- name: "configure nginx" - name: "configure nginx"

View File

@ -21,7 +21,7 @@ ExecStart=/usr/bin/podman run \
--user=0 \ --user=0 \
--entrypoint="/bin/bash" \ --entrypoint="/bin/bash" \
--name=pod-cloud-chown \ --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" -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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-chown.ctr-id
Type=oneshot Type=oneshot

View File

@ -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/data/_data:/var/www/html/data \
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \ -v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \
--name=pod-cloud-cron \ --name=pod-cloud-cron \
docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} \ docker.io/library/nextcloud:{{ services_service_deploy_versions.nextcloud }} \
/cron.sh /cron.sh
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-cloud-cron.ctr-id -t 10 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-cron.ctr-id

View File

@ -44,7 +44,7 @@ ExecStart=/usr/bin/podman run \
-e MAIL_FROM_ADDRESS="cloud" \ -e MAIL_FROM_ADDRESS="cloud" \
-e MAIL_DOMAIN="{{ services[services_service_name].domain }}" \ -e MAIL_DOMAIN="{{ services[services_service_name].domain }}" \
--name=pod-cloud-nextcloud \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-nextcloud.ctr-id
PIDFile=%t/container-cloud-nextcloud.pid PIDFile=%t/container-cloud-nextcloud.pid

View File

@ -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/nextcloud/_data:/var/www/html \
-v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \ -v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \
--name=pod-cloud-nginx \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-nginx.ctr-id
PIDFile=%t/container-cloud-nginx.pid PIDFile=%t/container-cloud-nginx.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "services/deploy/include"
vars_from: "versions"
- block: - block:
- name: "configure postgres password" - name: "configure postgres password"

View File

@ -27,7 +27,7 @@ ExecStart=/usr/bin/podman run \
-e POSTGRES_INITDB_WALDIR=/var/lib/postgresql-wal \ -e POSTGRES_INITDB_WALDIR=/var/lib/postgresql-wal \
-v {{ services_data_directory }}/pod-database/data/_data:/var/lib/postgresql/data \ -v {{ services_data_directory }}/pod-database/data/_data:/var/lib/postgresql/data \
--name=pod-database-postgres \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-database-postgres.ctr-id
PIDFile=%t/container-database-postgres.pid PIDFile=%t/container-database-postgres.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "services/deploy/include"
vars_from: "versions"
- block: - block:
- name: "configure systemd service" - name: "configure systemd service"

View File

@ -46,7 +46,7 @@ ExecStart=/usr/bin/podman run \
-e GITEA__service__DISABLE_REGISTRATION="true" \ -e GITEA__service__DISABLE_REGISTRATION="true" \
-e GITEA__service__ENABLE_NOTIFY_MAIL="true" \ -e GITEA__service__ENABLE_NOTIFY_MAIL="true" \
--name=pod-git-gitea \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-git-gitea.ctr-id
PIDFile=%t/container-git-gitea.pid PIDFile=%t/container-git-gitea.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "services/deploy/include"
vars_from: "versions"
- block: - block:
- name: "configure systemd service" - name: "configure systemd service"

View File

@ -29,7 +29,7 @@ ExecStart=/usr/bin/podman run \
-e ND_LASTFM_ENABLED="false" \ -e ND_LASTFM_ENABLED="false" \
-e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \ -e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \
--name=pod-music-archive \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-music-archive.ctr-id
PIDFile=%t/container-music-archive.pid PIDFile=%t/container-music-archive.pid

View File

@ -29,7 +29,7 @@ ExecStart=/usr/bin/podman run \
-e ND_LASTFM_ENABLED="false" \ -e ND_LASTFM_ENABLED="false" \
-e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \ -e ND_PASSWORDENCRYPTIONKEY={{ services[services_service_name].password_encryption_key }} \
--name=pod-music-collection \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-music-collection.ctr-id
PIDFile=%t/container-music-collection.pid PIDFile=%t/container-music-collection.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "services/deploy/include"
vars_from: "versions"
- block: - block:
- name: "configure systemd service" - name: "configure systemd service"

View File

@ -19,7 +19,7 @@ ExecStart=/usr/bin/podman run \
--user=0 \ --user=0 \
--entrypoint="/bin/bash" \ --entrypoint="/bin/bash" \
--name=pod-notes-chown \ --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" -c "chown -R joplin:joplin /data"
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-notes-chown.ctr-id ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-notes-chown.ctr-id
Type=oneshot Type=oneshot

View File

@ -42,7 +42,7 @@ ExecStart=/usr/bin/podman run \
-e MAILER_NOREPLY_EMAIL="notes@{{ services[services_service_name].domain }}" \ -e MAILER_NOREPLY_EMAIL="notes@{{ services[services_service_name].domain }}" \
-e STORAGE_DRIVER="Type=Filesystem; Path=/data" \ -e STORAGE_DRIVER="Type=Filesystem; Path=/data" \
--name=pod-notes-joplin \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-notes-joplin.ctr-id
PIDFile=%t/container-notes-joplin.pid PIDFile=%t/container-notes-joplin.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" 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" - name: "{{ services_service_name }} : set the rproxy variables"
ansible.builtin.include_vars: ansible.builtin.include_vars:
file: "nginx.yml" file: "nginx.yml"

View File

@ -30,7 +30,7 @@ ExecStart=/usr/bin/podman run \
-v var-lib-letsencrypt:/var/lib/letsencrypt:ro \ -v var-lib-letsencrypt:/var/lib/letsencrypt:ro \
-v var-www-html:/var/www/html \ -v var-www-html:/var/www/html \
--name=pod-{{ services_service_name }}-nginx \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-{{ services_service_name }}-nginx.ctr-id
PIDFile=%t/container-{{ services_service_name }}-nginx.pid PIDFile=%t/container-{{ services_service_name }}-nginx.pid

View File

@ -4,11 +4,6 @@
name: "services/include" name: "services/include"
vars_from: "user" 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" - name: "check if hugo is installed"
ansible.builtin.stat: ansible.builtin.stat:
path: "/usr/local/bin/hugo" path: "/usr/local/bin/hugo"

View File

@ -24,7 +24,7 @@ ExecStart=/usr/bin/podman run \
-v {{ services_root_directory }}/{{ services_resolv_host }}-resolv.conf:/etc/resolv.conf:ro \ -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 \ -v ./.config/pod-www/wojciechkozlowski.eu/public:/usr/share/nginx/html:ro \
--name=pod-www-nginx \ --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 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 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-www-nginx.ctr-id
PIDFile=%t/container-www-nginx.pid PIDFile=%t/container-www-nginx.pid

View File

@ -15,14 +15,9 @@
group: "{{ services_service_user_name }}" group: "{{ services_service_user_name }}"
mode: 0755 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" - name: "{{ services_service_name }} : directories : create volume directories"
ansible.builtin.include_tasks: "directories/volumes.yml" ansible.builtin.include_tasks: "directories/volumes.yml"
loop: "{{ services_volumes[services_service_name] | dict2items }}" loop: "{{ services_service_volumes | dict2items }}"
loop_control: loop_control:
loop_var: "services_service_volume" loop_var: "services_service_volume"

View File

@ -1,6 +1,8 @@
--- ---
- name: "services : asgard:&zfs" - name: "services : asgard:&zfs"
hosts: "asgard:&zfs" hosts: "asgard:&zfs"
vars_files:
- "vars/services/volumes.yml"
tasks: tasks:
- name: "datasets : user" - name: "datasets : user"
@ -13,6 +15,8 @@
- "services:datasets:user" - "services:datasets:user"
- "services:datasets:user:{{ services_service_name }}" - "services:datasets:user:{{ services_service_name }}"
- "services:{{ services_service_name }}:datasets:user" - "services:{{ services_service_name }}:datasets:user"
vars:
services_service_volumes: "{{ services_volumes[services_service_name] }}"
loop: "{{ services_host_services | dict2items | map(attribute='key') }}" loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
loop_control: loop_control:
loop_var: "services_service_name" loop_var: "services_service_name"
@ -20,6 +24,9 @@
- name: "services : asgard" - name: "services : asgard"
hosts: "asgard" hosts: "asgard"
vars_files:
- "vars/services/volumes.yml"
- "vars/services/deploy/versions.yml"
roles: roles:
- role: "services/setup/system" - role: "services/setup/system"
@ -38,6 +45,8 @@
- "services:setup:user" - "services:setup:user"
- "services:setup:user:{{ services_service_name }}" - "services:setup:user:{{ services_service_name }}"
- "services:{{ services_service_name }}:setup:user" - "services:{{ services_service_name }}:setup:user"
vars:
services_service_volumes: "{{ services_volumes[services_service_name] }}"
loop: "{{ services_host_services | dict2items | map(attribute='key') }}" loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
loop_control: loop_control:
loop_var: "services_service_name" 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/http-default.conf"
- "files/services/deploy/rproxy/nginx-conf.d/wojciechkozlowski.eu.conf" - "files/services/deploy/rproxy/nginx-conf.d/wojciechkozlowski.eu.conf"
- "files/services/deploy/rproxy/nginx-conf.d/www.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" when: "'rproxy' in services_host_services"
tags: "always" tags: "always"
@ -80,6 +90,7 @@
- "files/services/deploy/lrproxy/nginx-conf.d/git.wojciechkozlowski.eu.conf" - "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/music.wojciechkozlowski.eu.conf"
- "files/services/deploy/lrproxy/nginx-conf.d/notes.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" when: "'lrproxy' in services_host_services"
tags: "always" tags: "always"
@ -92,6 +103,8 @@
- "services:deploy" - "services:deploy"
- "services:deploy:{{ services_service_name }}" - "services:deploy:{{ services_service_name }}"
- "services:{{ services_service_name }}:deploy" - "services:{{ services_service_name }}:deploy"
vars:
services_service_deploy_versions: "{{ services_deploy_versions[services_service_name] }}"
loop: "{{ loop: "{{
services_host_services | dict2items | services_host_services | dict2items |
rejectattr('key', '==', 'rproxy') | rejectattr('key', '==', 'rproxy') |