Removed buggy variable mapping

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-03 12:07:19 +01:00
parent 273a785453
commit ece4fe465e
33 changed files with 34 additions and 43 deletions

View File

@ -1,20 +1,11 @@
--- ---
- name: variable mapping
hosts: all
vars:
activate_all_timers: "{{ activate_all_timers | lower | bool }}"
nginx_matomo_tracking: "{{ nginx_matomo_tracking | lower | bool }}"
execute_updates: "{{ execute_updates | lower | bool }}"
force_backup_before_update: "{{ force_backup_before_update | lower | bool }}"
enable_central_database: "{{ enable_central_database | lower | bool }}"
- name: update device - name: update device
hosts: all hosts: all
become: true become: true
tasks:
roles: roles:
- role: update - role: update
when: execute_updates when: execute_updates | bool
- name: setup standard wireguard - name: setup standard wireguard
hosts: wireguard_server hosts: wireguard_server

View File

@ -37,7 +37,7 @@
- name: configure backup-docker-to-local.timer.tpl - name: configure backup-docker-to-local.timer.tpl
template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer
register: backup_docker_to_local_timer register: backup_docker_to_local_timer
changed_when: backup_docker_to_local_timer.changed or activate_all_timers changed_when: backup_docker_to_local_timer.changed or activate_all_timers | bool
notify: restart backup-docker-to-local.timer notify: restart backup-docker-to-local.timer
when: run_once_backup_docker_to_local is not defined when: run_once_backup_docker_to_local is not defined

View File

@ -17,7 +17,7 @@
- name: create backup-remote-to-local.timer - name: create backup-remote-to-local.timer
template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer template: src=backup-remote-to-local.timer.j2 dest=/etc/systemd/system/backup-remote-to-local.timer
register: backup_backup_remote_to_local_timer register: backup_backup_remote_to_local_timer
changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers changed_when: backup_backup_remote_to_local_timer.changed or activate_all_timers | bool
notify: restart backup-remote-to-local timer notify: restart backup-remote-to-local timer
- name: create backups-remote-to-local.sh - name: create backups-remote-to-local.sh

View File

@ -3,7 +3,7 @@
src: "cleanup-backups.timer.j2" src: "cleanup-backups.timer.j2"
dest: "/etc/systemd/system/cleanup-backups.timer" dest: "/etc/systemd/system/cleanup-backups.timer"
register: cleanup_backups_timer register: cleanup_backups_timer
changed_when: cleanup_backups_timer.changed or activate_all_timers changed_when: cleanup_backups_timer.changed or activate_all_timers | bool
notify: restart cleanup-backups.timer notify: restart cleanup-backups.timer
when: run_once_cleanup_backups_timer is not defined when: run_once_cleanup_backups_timer is not defined

View File

@ -20,5 +20,5 @@
src: cleanup-disc-space.timer.j2 src: cleanup-disc-space.timer.j2
dest: /etc/systemd/system/cleanup-disc-space.timer dest: /etc/systemd/system/cleanup-disc-space.timer
register: cleanup_disc_space_timer register: cleanup_disc_space_timer
changed_when: cleanup_disc_space_timer.changed or activate_all_timers changed_when: cleanup_disc_space_timer.changed or activate_all_timers | bool
notify: restart cleanup-disc-space.timer notify: restart cleanup-disc-space.timer

View File

@ -24,7 +24,7 @@
src: cleanup-failed-docker-backups.timer.j2 src: cleanup-failed-docker-backups.timer.j2
dest: /etc/systemd/system/cleanup-failed-docker-backups.timer dest: /etc/systemd/system/cleanup-failed-docker-backups.timer
register: cleanup_failed_docker_backups_timer register: cleanup_failed_docker_backups_timer
changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers | bool
notify: restart cleanup-failed-docker-backups.timer notify: restart cleanup-failed-docker-backups.timer
when: run_once_cleanup_failed_docker_backups is not defined when: run_once_cleanup_failed_docker_backups is not defined

View File

@ -71,13 +71,13 @@ env:
DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }} DISCOURSE_SMTP_DOMAIN: {{ system_email_domain }}
DISCOURSE_NOTIFICATION_EMAIL: {{ system_email }} DISCOURSE_NOTIFICATION_EMAIL: {{ system_email }}
{% if enable_central_database %} {% if enable_central_database | bool %}
# Database Configuration # Database Configuration
DISCOURSE_DB_USERNAME: {{ database_username }} DISCOURSE_DB_USERNAME: {{ database_username }}
DISCOURSE_DB_PASSWORD: {{ database_password }} DISCOURSE_DB_PASSWORD: {{ database_password }}
DISCOURSE_DB_HOST: {{ database_host }} DISCOURSE_DB_HOST: {{ database_host }}
DISCOURSE_DB_NAME: {{ database_databasename }} DISCOURSE_DB_NAME: {{ database_databasename }}
{% if enable_central_database %} {% if enable_central_database | bool %}
## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
#LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world #LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world

View File

@ -64,5 +64,5 @@
src: "deploy-letsencrypt-mailu.timer.j2" src: "deploy-letsencrypt-mailu.timer.j2"
dest: "/etc/systemd/system/deploy-letsencrypt-mailu.timer" dest: "/etc/systemd/system/deploy-letsencrypt-mailu.timer"
register: deploy_letsencrypt_mailu_timer register: deploy_letsencrypt_mailu_timer
changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers changed_when: deploy_letsencrypt_mailu_timer.changed or activate_all_timers | bool
notify: restart deploy-letsencrypt-mailu.timer notify: restart deploy-letsencrypt-mailu.timer

View File

@ -8,7 +8,7 @@ server {
{% include 'roles/letsencrypt/templates/ssl_header.j2' %} {% include 'roles/letsencrypt/templates/ssl_header.j2' %}
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
{% endif %} {% endif %}

View File

@ -4,7 +4,7 @@ server
{% include 'roles/letsencrypt/templates/ssl_header.j2' %} {% include 'roles/letsencrypt/templates/ssl_header.j2' %}
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
{% endif %} {% endif %}

View File

@ -3,7 +3,7 @@ server {
{% include 'roles/letsencrypt/templates/ssl_header.j2' %} {% include 'roles/letsencrypt/templates/ssl_header.j2' %}
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
{% endif %} {% endif %}

View File

@ -23,7 +23,7 @@
src: heal-docker.timer.j2 src: heal-docker.timer.j2
dest: "/etc/systemd/system/heal-docker.timer" dest: "/etc/systemd/system/heal-docker.timer"
register: heal_docker_timer register: heal_docker_timer
changed_when: heal_docker_timer.changed or activate_all_timers changed_when: heal_docker_timer.changed or activate_all_timers | bool
notify: restart heal-docker.timer notify: restart heal-docker.timer
when: run_once_heal_docker is not defined when: run_once_heal_docker is not defined

View File

@ -20,5 +20,5 @@
src: health-btrfs.timer.j2 src: health-btrfs.timer.j2
dest: "/etc/systemd/system/health-btrfs.timer" dest: "/etc/systemd/system/health-btrfs.timer"
register: health_btrs_timer register: health_btrs_timer
changed_when: health_btrs_timer.changed or activate_all_timers changed_when: health_btrs_timer.changed or activate_all_timers | bool
notify: restart health-btrfs.timer notify: restart health-btrfs.timer

View File

@ -20,5 +20,5 @@
src: health-disc-space.timer.j2 src: health-disc-space.timer.j2
dest: /etc/systemd/system/health-disc-space.timer dest: /etc/systemd/system/health-disc-space.timer
register: health_disc_space_timer register: health_disc_space_timer
changed_when: health_disc_space_timer.changed or activate_all_timers changed_when: health_disc_space_timer.changed or activate_all_timers | bool
notify: restart health-disc-space.timer notify: restart health-disc-space.timer

View File

@ -21,7 +21,7 @@
src: health-docker-container.timer.j2 src: health-docker-container.timer.j2
dest: "/etc/systemd/system/health-docker-container.timer" dest: "/etc/systemd/system/health-docker-container.timer"
register: health_docker_container_timer register: health_docker_container_timer
changed_when: health_docker_container_timer.changed or activate_all_timers changed_when: health_docker_container_timer.changed or activate_all_timers | bool
notify: restart health-docker-container.timer notify: restart health-docker-container.timer
when: run_once_health_docker_container is not defined when: run_once_health_docker_container is not defined

View File

@ -21,7 +21,7 @@
src: health-docker-volumes.timer.j2 src: health-docker-volumes.timer.j2
dest: "/etc/systemd/system/health-docker-volumes.timer" dest: "/etc/systemd/system/health-docker-volumes.timer"
register: health_docker_volumes_timer register: health_docker_volumes_timer
changed_when: health_docker_volumes_timer.changed or activate_all_timers changed_when: health_docker_volumes_timer.changed or activate_all_timers | bool
notify: restart health-docker-volumes.timer notify: restart health-docker-volumes.timer
when: run_once_health_docker_volumes is not defined when: run_once_health_docker_volumes is not defined

View File

@ -20,5 +20,5 @@
src: health-journalctl.timer.j2 src: health-journalctl.timer.j2
dest: /etc/systemd/system/health-journalctl.timer dest: /etc/systemd/system/health-journalctl.timer
register: health_journalctl_timer register: health_journalctl_timer
changed_when: health_journalctl_timer.changed or activate_all_timers changed_when: health_journalctl_timer.changed or activate_all_timers | bool
notify: restart health-journalctl.timer notify: restart health-journalctl.timer

View File

@ -29,7 +29,7 @@
src: health-nginx.timer.j2 src: health-nginx.timer.j2
dest: "/etc/systemd/system/health-nginx.timer" dest: "/etc/systemd/system/health-nginx.timer"
register: health_nginx_timer register: health_nginx_timer
changed_when: health_nginx_timer.changed or activate_all_timers changed_when: health_nginx_timer.changed or activate_all_timers | bool
notify: restart health-nginx.timer notify: restart health-nginx.timer
when: run_once_health_nginx is not defined when: run_once_health_nginx is not defined

View File

@ -31,7 +31,7 @@ for filename in os.listdir(config_path):
# Determine expected status codes based on the domain # Determine expected status codes based on the domain
if domain == '{{domain_listmonk}}': if domain == '{{domain_listmonk}}':
expected_statuses = [401] expected_statuses = [401]
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
elif parts[0] == 'www' or domain in redirected_domains: elif parts[0] == 'www' or domain in redirected_domains:
expected_statuses = [301] expected_statuses = [301]
{% endif %} {% endif %}

View File

@ -16,7 +16,7 @@
src: certbot.timer.j2 src: certbot.timer.j2
dest: /etc/systemd/system/certbot.timer dest: /etc/systemd/system/certbot.timer
register: certbot_timer register: certbot_timer
changed_when: certbot_timer.changed or activate_all_timers changed_when: certbot_timer.changed or activate_all_timers | bool
notify: restart certbot timer notify: restart certbot timer
when: run_once_nginx_certbot is not defined when: run_once_nginx_certbot is not defined

View File

@ -3,7 +3,7 @@ server
server_name {{domain}}; server_name {{domain}};
# Include Matomo Tracking Code # Include Matomo Tracking Code
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
{% endif %} {% endif %}

View File

@ -5,7 +5,7 @@ server
{% include 'roles/letsencrypt/templates/ssl_header.j2' %} {% include 'roles/letsencrypt/templates/ssl_header.j2' %}
{% if nginx_matomo_tracking %} {% if nginx_matomo_tracking | bool %}
{% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %} {% include 'roles/nginx-matomo-tracking/templates/matomo-tracking.conf.j2' %}
{% endif %} {% endif %}

View File

@ -2,7 +2,7 @@
systemd: systemd:
name: backup-docker-to-local-everything.service name: backup-docker-to-local-everything.service
state: started state: started
when: force_backup_before_update when: force_backup_before_update | bool
- name: create {{update_docker_script}} - name: create {{update_docker_script}}
copy: copy:

View File

@ -1,4 +1,4 @@
- name: Activate NGINX matomo tracking - name: Activate NGINX matomo tracking
include_role: include_role:
name: nginx-matomo-tracking name: nginx-matomo-tracking
when: nginx_matomo_tracking and domain is defined when: nginx_matomo_tracking | bool and domain is defined

View File

@ -1,6 +1,6 @@
# This template needs to be included in docker-compose.yml # This template needs to be included in docker-compose.yml
networks: networks:
{% if enable_central_database %} {% if enable_central_database | bool %}
central_{{ database_type }}_network: central_{{ database_type }}_network:
external: true external: true
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
# This needs to be included in docker-compose.yml which just contain a database volume # This needs to be included in docker-compose.yml which just contain a database volume
{% if not enable_central_database %} {% if not enable_central_database | bool %}
volumes: volumes:
database: database:
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml which contain a database and additional volumes # This template needs to be included in docker-compose.yml which contain a database and additional volumes
volumes: volumes:
{% if not enable_central_database %} {% if not enable_central_database | bool %}
database: database:
{% endif %} {% endif %}

View File

@ -1,6 +1,6 @@
# This template needs to be included in docker-compose.yml containers which depend on a database and additional containers # This template needs to be included in docker-compose.yml containers which depend on a database and additional containers
depends_on: depends_on:
{% if enable_central_database %} {% if enable_central_database | bool %}
database: database:
condition: service_healthy condition: service_healthy
{% endif %} {% endif %}

View File

@ -1,6 +1,6 @@
# This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes # This template needs to be included in docker-compose.yml contaienrs, which depend on a database, redis and optional additional volumes
depends_on: depends_on:
{% if enable_central_database %} {% if enable_central_database | bool %}
database: database:
condition: service_healthy condition: service_healthy
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml contaienrs, which just depend on a database # This template needs to be included in docker-compose.yml contaienrs, which just depend on a database
{% if enable_central_database %} {% if enable_central_database | bool %}
depends_on: depends_on:
database: database:
condition: service_healthy condition: service_healthy

View File

@ -1,6 +1,6 @@
# This template needs to be included in docker-compose.yml containers # This template needs to be included in docker-compose.yml containers
networks: networks:
- {{docker_compose_project_name}}_network - {{docker_compose_project_name}}_network
{% if enable_central_database %} {% if enable_central_database | bool %}
- central_{{ database_type }}_network - central_{{ database_type }}_network
{% endif %} {% endif %}

View File

@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml, which depend on a mariadb database # This template needs to be included in docker-compose.yml, which depend on a mariadb database
{% if not enable_central_database %} {% if not enable_central_database | bool %}
database: database:
logging: logging:
driver: journald driver: journald

View File

@ -1,5 +1,5 @@
# This template needs to be included in docker-compose.yml, which depend on a postgres database # This template needs to be included in docker-compose.yml, which depend on a postgres database
{% if not enable_central_database %} {% if not enable_central_database | bool %}
database: database:
image: postgres:{{database_version}}-alpine image: postgres:{{database_version}}-alpine
environment: environment: