diff --git a/.gitignore b/.gitignore index ebf0b61..b9aa3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,8 @@ dns/services.json secrets.auto.tfvars .terraform -inventory/group_vars/all/serguzim.net.yml -inventory/group_vars/all/opentofu.yml -inventory/group_vars/all/all_services.yml +playbooks/inventory/group_vars/all/serguzim.net.yml +playbooks/inventory/group_vars/all/opentofu.yml +playbooks/inventory/group_vars/all/all_services.yml infrastructure.svg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94c977e..bbffbea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,4 +4,10 @@ repos: hooks: - id: ansible-lint args: + - playbooks/tasks/ - playbooks/serguzim.net.yml + - playbooks/for-ansible-lint.yml + - repo: https://github.com/gitleaks/gitleaks + rev: v8.20.1 + hooks: + - id: gitleaks diff --git a/Makefile b/Makefile index fd5d543..fe905b3 100644 --- a/Makefile +++ b/Makefile @@ -9,28 +9,28 @@ PWD := $(shell pwd) .FORCE: -./inventory/group_vars/all/all_services.yml: .FORCE +./playbooks/inventory/group_vars/all/all_services.yml: .FORCE tofu output --json \ | yq -y '{all_services: with_entries(.value |= .value).services | to_entries | map(.value)}' \ - > ./inventory/group_vars/all/all_services.yml + > ./playbooks/inventory/group_vars/all/all_services.yml -./inventory/group_vars/all/opentofu.yml: .FORCE +./playbooks/inventory/group_vars/all/opentofu.yml: .FORCE tofu output --json \ | yq -y '{opentofu: with_entries(.value |= .value)}' \ - > ./inventory/group_vars/all/opentofu.yml + > ./playbooks/inventory/group_vars/all/opentofu.yml ./dns/hosts.json: .FORCE tofu output --json \ | jq 'with_entries(.value |= .value).hosts' \ > ./dns/hosts.json -./dns/services.json: ./inventory/group_vars/all/all_services.yml +./dns/services.json: ./playbooks/inventory/group_vars/all/all_services.yml ansible-playbook \ -e services_json_file=$(PWD)/dns/services.json \ playbooks/create_services_for_dnscontrol.yml -output: ./dns/hosts.json ./dns/services.json ./inventory/group_vars/all/opentofu.yml +output: ./dns/hosts.json ./dns/services.json ./playbooks/inventory/group_vars/all/opentofu.yml ./types-dnscontrol.d.ts: diff --git a/ansible.cfg b/ansible.cfg deleted file mode 100644 index 79a1afc..0000000 --- a/ansible.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[defaults] -inventory = ./inventory -roles_path = ./roles diff --git a/playbooks/for-ansible-lint.yml b/playbooks/for-ansible-lint.yml new file mode 100644 index 0000000..c5043ee --- /dev/null +++ b/playbooks/for-ansible-lint.yml @@ -0,0 +1,41 @@ +--- +- name: Run all roles + hosts: serguzim_net + vars: + host_services: "{{ all_services | my_service_attributes(inventory_hostname) | union(common_services) }}" + roles: + - acme_dns + - always + - authentik + - backup + - caddy + - extra_services + - faas + - forgejo + - forgejo_runner + - gatus + - healthcheck + - homebox + - immich + - influxdb + - jellyfin + - lego + - linkwarden + - mailcowdockerized + - minecraft_2 + - minio + - ntfy + - postgresql + - reitanlage_oranienburg + - shlink + - software + - synapse + - tandoor + - teamspeak_fallback + - telegraf + - tinytinyrss + - umami + - vikunja + - watchtower + - wiki_js + - woodpecker diff --git a/inventory/group_vars/all/compose_defaults.yml b/playbooks/inventory/group_vars/all/compose_defaults.yml similarity index 100% rename from inventory/group_vars/all/compose_defaults.yml rename to playbooks/inventory/group_vars/all/compose_defaults.yml diff --git a/inventory/group_vars/all/main.yml b/playbooks/inventory/group_vars/all/main.yml similarity index 100% rename from inventory/group_vars/all/main.yml rename to playbooks/inventory/group_vars/all/main.yml diff --git a/inventory/serguzim.net.yml b/playbooks/inventory/serguzim.net.yml similarity index 100% rename from inventory/serguzim.net.yml rename to playbooks/inventory/serguzim.net.yml diff --git a/roles/_TEMPLATE/tasks/main.yml b/playbooks/roles/_TEMPLATE/tasks/main.yml similarity index 100% rename from roles/_TEMPLATE/tasks/main.yml rename to playbooks/roles/_TEMPLATE/tasks/main.yml diff --git a/roles/_TEMPLATE/vars/main.yml b/playbooks/roles/_TEMPLATE/vars/main.yml similarity index 100% rename from roles/_TEMPLATE/vars/main.yml rename to playbooks/roles/_TEMPLATE/vars/main.yml diff --git a/roles/acme_dns/tasks/main.yml b/playbooks/roles/acme_dns/tasks/main.yml similarity index 100% rename from roles/acme_dns/tasks/main.yml rename to playbooks/roles/acme_dns/tasks/main.yml diff --git a/roles/acme_dns/templates/config.cfg.j2 b/playbooks/roles/acme_dns/templates/config.cfg.j2 similarity index 100% rename from roles/acme_dns/templates/config.cfg.j2 rename to playbooks/roles/acme_dns/templates/config.cfg.j2 diff --git a/roles/acme_dns/vars/main.yml b/playbooks/roles/acme_dns/vars/main.yml similarity index 100% rename from roles/acme_dns/vars/main.yml rename to playbooks/roles/acme_dns/vars/main.yml diff --git a/roles/always/handlers/main.yml b/playbooks/roles/always/handlers/main.yml similarity index 100% rename from roles/always/handlers/main.yml rename to playbooks/roles/always/handlers/main.yml diff --git a/roles/always/tasks/main.yml b/playbooks/roles/always/tasks/main.yml similarity index 100% rename from roles/always/tasks/main.yml rename to playbooks/roles/always/tasks/main.yml diff --git a/roles/authentik/tasks/main.yml b/playbooks/roles/authentik/tasks/main.yml similarity index 100% rename from roles/authentik/tasks/main.yml rename to playbooks/roles/authentik/tasks/main.yml diff --git a/roles/authentik/vars/main.yml b/playbooks/roles/authentik/vars/main.yml similarity index 100% rename from roles/authentik/vars/main.yml rename to playbooks/roles/authentik/vars/main.yml diff --git a/roles/backup/files/backup.timer b/playbooks/roles/backup/files/backup.timer similarity index 100% rename from roles/backup/files/backup.timer rename to playbooks/roles/backup/files/backup.timer diff --git a/roles/backup/files/hooks/immich_database b/playbooks/roles/backup/files/hooks/immich_database similarity index 100% rename from roles/backup/files/hooks/immich_database rename to playbooks/roles/backup/files/hooks/immich_database diff --git a/roles/backup/files/hooks/mailcowdockerized b/playbooks/roles/backup/files/hooks/mailcowdockerized similarity index 100% rename from roles/backup/files/hooks/mailcowdockerized rename to playbooks/roles/backup/files/hooks/mailcowdockerized diff --git a/roles/backup/files/hooks/postgresql b/playbooks/roles/backup/files/hooks/postgresql similarity index 100% rename from roles/backup/files/hooks/postgresql rename to playbooks/roles/backup/files/hooks/postgresql diff --git a/roles/backup/tasks/hooks.yml b/playbooks/roles/backup/tasks/hooks.yml similarity index 100% rename from roles/backup/tasks/hooks.yml rename to playbooks/roles/backup/tasks/hooks.yml diff --git a/roles/backup/tasks/main.yml b/playbooks/roles/backup/tasks/main.yml similarity index 100% rename from roles/backup/tasks/main.yml rename to playbooks/roles/backup/tasks/main.yml diff --git a/roles/backup/tasks/systemd.yml b/playbooks/roles/backup/tasks/systemd.yml similarity index 100% rename from roles/backup/tasks/systemd.yml rename to playbooks/roles/backup/tasks/systemd.yml diff --git a/roles/backup/templates/backup.service.j2 b/playbooks/roles/backup/templates/backup.service.j2 similarity index 100% rename from roles/backup/templates/backup.service.j2 rename to playbooks/roles/backup/templates/backup.service.j2 diff --git a/roles/backup/templates/backup.sh.j2 b/playbooks/roles/backup/templates/backup.sh.j2 similarity index 100% rename from roles/backup/templates/backup.sh.j2 rename to playbooks/roles/backup/templates/backup.sh.j2 diff --git a/roles/backup/vars/main.yml b/playbooks/roles/backup/vars/main.yml similarity index 96% rename from roles/backup/vars/main.yml rename to playbooks/roles/backup/vars/main.yml index 60a4d76..026b825 100644 --- a/roles/backup/vars/main.yml +++ b/playbooks/roles/backup/vars/main.yml @@ -44,7 +44,7 @@ backup_yml: backends: "{{ vault_backup.backends }}" - locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}" + locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks) }}" global: "{{ backup_global }}" @@ -53,6 +53,6 @@ backup_yml_all: backends: "{{ vault_backup.backends }}" - locations: "{{ backup_list_all | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}" + locations: "{{ backup_list_all | map_backup_locations(vault_backup.backends, backup_default_hooks) }}" global: "{{ backup_global }}" diff --git a/roles/caddy/defaults/main.yml b/playbooks/roles/caddy/defaults/main.yml similarity index 100% rename from roles/caddy/defaults/main.yml rename to playbooks/roles/caddy/defaults/main.yml diff --git a/roles/caddy/files/Dockerfile b/playbooks/roles/caddy/files/Dockerfile similarity index 100% rename from roles/caddy/files/Dockerfile rename to playbooks/roles/caddy/files/Dockerfile diff --git a/roles/caddy/files/snippets b/playbooks/roles/caddy/files/snippets similarity index 100% rename from roles/caddy/files/snippets rename to playbooks/roles/caddy/files/snippets diff --git a/roles/caddy/tasks/main.yml b/playbooks/roles/caddy/tasks/main.yml similarity index 100% rename from roles/caddy/tasks/main.yml rename to playbooks/roles/caddy/tasks/main.yml diff --git a/roles/caddy/templates/Caddyfile.j2 b/playbooks/roles/caddy/templates/Caddyfile.j2 similarity index 100% rename from roles/caddy/templates/Caddyfile.j2 rename to playbooks/roles/caddy/templates/Caddyfile.j2 diff --git a/roles/caddy/vars/main.yml b/playbooks/roles/caddy/vars/main.yml similarity index 100% rename from roles/caddy/vars/main.yml rename to playbooks/roles/caddy/vars/main.yml diff --git a/roles/extra_services/tasks/main.yml b/playbooks/roles/extra_services/tasks/main.yml similarity index 100% rename from roles/extra_services/tasks/main.yml rename to playbooks/roles/extra_services/tasks/main.yml diff --git a/roles/extra_services/vars/main.yml b/playbooks/roles/extra_services/vars/main.yml similarity index 100% rename from roles/extra_services/vars/main.yml rename to playbooks/roles/extra_services/vars/main.yml diff --git a/roles/faas/tasks/main.yml b/playbooks/roles/faas/tasks/main.yml similarity index 100% rename from roles/faas/tasks/main.yml rename to playbooks/roles/faas/tasks/main.yml diff --git a/roles/faas/vars/main.yml b/playbooks/roles/faas/vars/main.yml similarity index 100% rename from roles/faas/vars/main.yml rename to playbooks/roles/faas/vars/main.yml diff --git a/roles/forgejo/files/templates/custom/extra_links_footer.tmpl b/playbooks/roles/forgejo/files/templates/custom/extra_links_footer.tmpl similarity index 100% rename from roles/forgejo/files/templates/custom/extra_links_footer.tmpl rename to playbooks/roles/forgejo/files/templates/custom/extra_links_footer.tmpl diff --git a/roles/forgejo/tasks/main.yml b/playbooks/roles/forgejo/tasks/main.yml similarity index 100% rename from roles/forgejo/tasks/main.yml rename to playbooks/roles/forgejo/tasks/main.yml diff --git a/roles/forgejo/templates/footer.tmpl.j2 b/playbooks/roles/forgejo/templates/footer.tmpl.j2 similarity index 100% rename from roles/forgejo/templates/footer.tmpl.j2 rename to playbooks/roles/forgejo/templates/footer.tmpl.j2 diff --git a/roles/forgejo/vars/main.yml b/playbooks/roles/forgejo/vars/main.yml similarity index 100% rename from roles/forgejo/vars/main.yml rename to playbooks/roles/forgejo/vars/main.yml diff --git a/roles/forgejo_runner/files/config.yml b/playbooks/roles/forgejo_runner/files/config.yml similarity index 100% rename from roles/forgejo_runner/files/config.yml rename to playbooks/roles/forgejo_runner/files/config.yml diff --git a/roles/forgejo_runner/tasks/main.yml b/playbooks/roles/forgejo_runner/tasks/main.yml similarity index 100% rename from roles/forgejo_runner/tasks/main.yml rename to playbooks/roles/forgejo_runner/tasks/main.yml diff --git a/roles/forgejo_runner/tasks/prompt-registration-token.yml b/playbooks/roles/forgejo_runner/tasks/prompt-registration-token.yml similarity index 100% rename from roles/forgejo_runner/tasks/prompt-registration-token.yml rename to playbooks/roles/forgejo_runner/tasks/prompt-registration-token.yml diff --git a/roles/forgejo_runner/vars/main.yml b/playbooks/roles/forgejo_runner/vars/main.yml similarity index 100% rename from roles/forgejo_runner/vars/main.yml rename to playbooks/roles/forgejo_runner/vars/main.yml diff --git a/roles/gatus/tasks/main.yml b/playbooks/roles/gatus/tasks/main.yml similarity index 100% rename from roles/gatus/tasks/main.yml rename to playbooks/roles/gatus/tasks/main.yml diff --git a/roles/gatus/vars/main.yml b/playbooks/roles/gatus/vars/main.yml similarity index 100% rename from roles/gatus/vars/main.yml rename to playbooks/roles/gatus/vars/main.yml diff --git a/roles/healthcheck/files/Dockerfile b/playbooks/roles/healthcheck/files/Dockerfile similarity index 100% rename from roles/healthcheck/files/Dockerfile rename to playbooks/roles/healthcheck/files/Dockerfile diff --git a/roles/healthcheck/files/data/mail b/playbooks/roles/healthcheck/files/data/mail similarity index 100% rename from roles/healthcheck/files/data/mail rename to playbooks/roles/healthcheck/files/data/mail diff --git a/roles/healthcheck/files/data/mailcheck.template.mail b/playbooks/roles/healthcheck/files/data/mailcheck.template.mail similarity index 100% rename from roles/healthcheck/files/data/mailcheck.template.mail rename to playbooks/roles/healthcheck/files/data/mailcheck.template.mail diff --git a/roles/healthcheck/files/data/matrix b/playbooks/roles/healthcheck/files/data/matrix similarity index 100% rename from roles/healthcheck/files/data/matrix rename to playbooks/roles/healthcheck/files/data/matrix diff --git a/roles/healthcheck/files/data/template.msmtprc b/playbooks/roles/healthcheck/files/data/template.msmtprc similarity index 100% rename from roles/healthcheck/files/data/template.msmtprc rename to playbooks/roles/healthcheck/files/data/template.msmtprc diff --git a/roles/healthcheck/files/healthcheck@.timer b/playbooks/roles/healthcheck/files/healthcheck@.timer similarity index 100% rename from roles/healthcheck/files/healthcheck@.timer rename to playbooks/roles/healthcheck/files/healthcheck@.timer diff --git a/roles/healthcheck/tasks/docker.yml b/playbooks/roles/healthcheck/tasks/docker.yml similarity index 100% rename from roles/healthcheck/tasks/docker.yml rename to playbooks/roles/healthcheck/tasks/docker.yml diff --git a/roles/healthcheck/tasks/main.yml b/playbooks/roles/healthcheck/tasks/main.yml similarity index 100% rename from roles/healthcheck/tasks/main.yml rename to playbooks/roles/healthcheck/tasks/main.yml diff --git a/roles/healthcheck/tasks/systemd.yml b/playbooks/roles/healthcheck/tasks/systemd.yml similarity index 86% rename from roles/healthcheck/tasks/systemd.yml rename to playbooks/roles/healthcheck/tasks/systemd.yml index d063b1e..d9def2d 100644 --- a/roles/healthcheck/tasks/systemd.yml +++ b/playbooks/roles/healthcheck/tasks/systemd.yml @@ -13,8 +13,8 @@ become: true - name: Get all healthcheck timers - ansible.builtin.shell: - cmd: "systemctl list-timers 'healthcheck@*' --all --output=json | jq -r '.[].unit'" + ansible.builtin.shell: # noqa: command-instead-of-module + cmd: "set -o pipefail && systemctl list-timers 'healthcheck@*' --all --output=json | jq -r '.[].unit'" register: systemd_timers_result changed_when: false diff --git a/roles/healthcheck/templates/docker-compose.yml.j2 b/playbooks/roles/healthcheck/templates/docker-compose.yml.j2 similarity index 100% rename from roles/healthcheck/templates/docker-compose.yml.j2 rename to playbooks/roles/healthcheck/templates/docker-compose.yml.j2 diff --git a/roles/healthcheck/templates/healthcheck@.service.j2 b/playbooks/roles/healthcheck/templates/healthcheck@.service.j2 similarity index 100% rename from roles/healthcheck/templates/healthcheck@.service.j2 rename to playbooks/roles/healthcheck/templates/healthcheck@.service.j2 diff --git a/roles/healthcheck/vars/main.yml b/playbooks/roles/healthcheck/vars/main.yml similarity index 100% rename from roles/healthcheck/vars/main.yml rename to playbooks/roles/healthcheck/vars/main.yml diff --git a/roles/homebox/tasks/main.yml b/playbooks/roles/homebox/tasks/main.yml similarity index 100% rename from roles/homebox/tasks/main.yml rename to playbooks/roles/homebox/tasks/main.yml diff --git a/roles/homebox/vars/main.yml b/playbooks/roles/homebox/vars/main.yml similarity index 100% rename from roles/homebox/vars/main.yml rename to playbooks/roles/homebox/vars/main.yml diff --git a/roles/immich/tasks/main.yml b/playbooks/roles/immich/tasks/main.yml similarity index 100% rename from roles/immich/tasks/main.yml rename to playbooks/roles/immich/tasks/main.yml diff --git a/roles/immich/vars/main.yml b/playbooks/roles/immich/vars/main.yml similarity index 100% rename from roles/immich/vars/main.yml rename to playbooks/roles/immich/vars/main.yml diff --git a/roles/influxdb/tasks/main.yml b/playbooks/roles/influxdb/tasks/main.yml similarity index 100% rename from roles/influxdb/tasks/main.yml rename to playbooks/roles/influxdb/tasks/main.yml diff --git a/roles/influxdb/vars/main.yml b/playbooks/roles/influxdb/vars/main.yml similarity index 100% rename from roles/influxdb/vars/main.yml rename to playbooks/roles/influxdb/vars/main.yml diff --git a/roles/jellyfin/tasks/main.yml b/playbooks/roles/jellyfin/tasks/main.yml similarity index 100% rename from roles/jellyfin/tasks/main.yml rename to playbooks/roles/jellyfin/tasks/main.yml diff --git a/roles/jellyfin/vars/main.yml b/playbooks/roles/jellyfin/vars/main.yml similarity index 100% rename from roles/jellyfin/vars/main.yml rename to playbooks/roles/jellyfin/vars/main.yml diff --git a/roles/lego/files/hook.sh b/playbooks/roles/lego/files/hook.sh similarity index 100% rename from roles/lego/files/hook.sh rename to playbooks/roles/lego/files/hook.sh diff --git a/roles/lego/files/hooks/auth.serguzim.me b/playbooks/roles/lego/files/hooks/auth.serguzim.me similarity index 100% rename from roles/lego/files/hooks/auth.serguzim.me rename to playbooks/roles/lego/files/hooks/auth.serguzim.me diff --git a/roles/lego/files/hooks/db.serguzim.me b/playbooks/roles/lego/files/hooks/db.serguzim.me similarity index 100% rename from roles/lego/files/hooks/db.serguzim.me rename to playbooks/roles/lego/files/hooks/db.serguzim.me diff --git a/roles/lego/files/lego.sh b/playbooks/roles/lego/files/lego.sh similarity index 100% rename from roles/lego/files/lego.sh rename to playbooks/roles/lego/files/lego.sh diff --git a/roles/lego/files/lego@.timer b/playbooks/roles/lego/files/lego@.timer similarity index 100% rename from roles/lego/files/lego@.timer rename to playbooks/roles/lego/files/lego@.timer diff --git a/roles/lego/tasks/config.yml b/playbooks/roles/lego/tasks/config.yml similarity index 100% rename from roles/lego/tasks/config.yml rename to playbooks/roles/lego/tasks/config.yml diff --git a/roles/lego/tasks/hooks.yml b/playbooks/roles/lego/tasks/hooks.yml similarity index 100% rename from roles/lego/tasks/hooks.yml rename to playbooks/roles/lego/tasks/hooks.yml diff --git a/roles/lego/tasks/main.yml b/playbooks/roles/lego/tasks/main.yml similarity index 100% rename from roles/lego/tasks/main.yml rename to playbooks/roles/lego/tasks/main.yml diff --git a/roles/lego/tasks/systemd.yml b/playbooks/roles/lego/tasks/systemd.yml similarity index 91% rename from roles/lego/tasks/systemd.yml rename to playbooks/roles/lego/tasks/systemd.yml index 725f980..e8c2a17 100644 --- a/roles/lego/tasks/systemd.yml +++ b/playbooks/roles/lego/tasks/systemd.yml @@ -14,7 +14,7 @@ - name: Get all lego timers ansible.builtin.shell: - cmd: "systemctl list-timers 'lego@*' --all --output=json | jq -r '.[].unit'" + cmd: "set -o pipefail && systemctl list-timers 'lego@*' --all --output=json | jq -r '.[].unit'" register: systemd_timers_result changed_when: false diff --git a/roles/lego/templates/lego@.service.j2 b/playbooks/roles/lego/templates/lego@.service.j2 similarity index 100% rename from roles/lego/templates/lego@.service.j2 rename to playbooks/roles/lego/templates/lego@.service.j2 diff --git a/roles/lego/vars/main.yml b/playbooks/roles/lego/vars/main.yml similarity index 100% rename from roles/lego/vars/main.yml rename to playbooks/roles/lego/vars/main.yml diff --git a/roles/linkwarden/tasks/main.yml b/playbooks/roles/linkwarden/tasks/main.yml similarity index 100% rename from roles/linkwarden/tasks/main.yml rename to playbooks/roles/linkwarden/tasks/main.yml diff --git a/roles/linkwarden/vars/main.yml b/playbooks/roles/linkwarden/vars/main.yml similarity index 100% rename from roles/linkwarden/vars/main.yml rename to playbooks/roles/linkwarden/vars/main.yml diff --git a/roles/mailcowdockerized/tasks/main.yml b/playbooks/roles/mailcowdockerized/tasks/main.yml similarity index 100% rename from roles/mailcowdockerized/tasks/main.yml rename to playbooks/roles/mailcowdockerized/tasks/main.yml diff --git a/roles/mailcowdockerized/vars/main.yml b/playbooks/roles/mailcowdockerized/vars/main.yml similarity index 100% rename from roles/mailcowdockerized/vars/main.yml rename to playbooks/roles/mailcowdockerized/vars/main.yml diff --git a/roles/minecraft_2/tasks/main.yml b/playbooks/roles/minecraft_2/tasks/main.yml similarity index 100% rename from roles/minecraft_2/tasks/main.yml rename to playbooks/roles/minecraft_2/tasks/main.yml diff --git a/roles/minecraft_2/vars/main.yml b/playbooks/roles/minecraft_2/vars/main.yml similarity index 100% rename from roles/minecraft_2/vars/main.yml rename to playbooks/roles/minecraft_2/vars/main.yml diff --git a/roles/minio/tasks/main.yml b/playbooks/roles/minio/tasks/main.yml similarity index 100% rename from roles/minio/tasks/main.yml rename to playbooks/roles/minio/tasks/main.yml diff --git a/roles/minio/vars/main.yml b/playbooks/roles/minio/vars/main.yml similarity index 100% rename from roles/minio/vars/main.yml rename to playbooks/roles/minio/vars/main.yml diff --git a/roles/ntfy/tasks/main.yml b/playbooks/roles/ntfy/tasks/main.yml similarity index 100% rename from roles/ntfy/tasks/main.yml rename to playbooks/roles/ntfy/tasks/main.yml diff --git a/roles/ntfy/vars/main.yml b/playbooks/roles/ntfy/vars/main.yml similarity index 100% rename from roles/ntfy/vars/main.yml rename to playbooks/roles/ntfy/vars/main.yml diff --git a/roles/postgresql/.gitkeep b/playbooks/roles/postgresql/.gitkeep similarity index 100% rename from roles/postgresql/.gitkeep rename to playbooks/roles/postgresql/.gitkeep diff --git a/roles/reitanlage_oranienburg/tasks/main.yml b/playbooks/roles/reitanlage_oranienburg/tasks/main.yml similarity index 100% rename from roles/reitanlage_oranienburg/tasks/main.yml rename to playbooks/roles/reitanlage_oranienburg/tasks/main.yml diff --git a/roles/reitanlage_oranienburg/vars/main.yml b/playbooks/roles/reitanlage_oranienburg/vars/main.yml similarity index 100% rename from roles/reitanlage_oranienburg/vars/main.yml rename to playbooks/roles/reitanlage_oranienburg/vars/main.yml diff --git a/roles/shlink/tasks/main.yml b/playbooks/roles/shlink/tasks/main.yml similarity index 100% rename from roles/shlink/tasks/main.yml rename to playbooks/roles/shlink/tasks/main.yml diff --git a/roles/shlink/vars/main.yml b/playbooks/roles/shlink/vars/main.yml similarity index 100% rename from roles/shlink/vars/main.yml rename to playbooks/roles/shlink/vars/main.yml diff --git a/roles/software/tasks/docker.yml b/playbooks/roles/software/tasks/docker.yml similarity index 82% rename from roles/software/tasks/docker.yml rename to playbooks/roles/software/tasks/docker.yml index 377d97a..ad0aea8 100644 --- a/roles/software/tasks/docker.yml +++ b/playbooks/roles/software/tasks/docker.yml @@ -1,5 +1,5 @@ - name: Install required system packages - apt: + ansible.builtin.apt: pkg: - apt-transport-https - ca-certificates @@ -8,39 +8,39 @@ - python3-pip - virtualenv - python3-setuptools - state: latest + state: present update_cache: true become: true - name: Add Docker GPG apt Key - apt_key: + ansible.builtin.apt_key: url: https://download.docker.com/linux/ubuntu/gpg state: present become: true - name: Add Docker Repository - apt_repository: + ansible.builtin.apt_repository: repo: deb https://download.docker.com/linux/ubuntu focal stable state: present become: true - name: Update apt and install docker packages - apt: + ansible.builtin.apt: pkg: - docker-ce - docker-ce-cli - containerd.io - docker-buildx-plugin - docker-compose-plugin - state: latest + state: present update_cache: true become: true - name: Add user to the Docker group - user: + ansible.builtin.user: name: "{{ ansible_user }}" groups: docker - append: yes + append: true become: true - name: Create a network diff --git a/roles/software/tasks/main.yml b/playbooks/roles/software/tasks/main.yml similarity index 56% rename from roles/software/tasks/main.yml rename to playbooks/roles/software/tasks/main.yml index db3db7f..9d3cf35 100644 --- a/roles/software/tasks/main.yml +++ b/playbooks/roles/software/tasks/main.yml @@ -1,7 +1,7 @@ - name: Install aptitude - apt: + ansible.builtin.apt: name: aptitude - state: latest + state: present update_cache: true become: true @@ -9,32 +9,34 @@ ansible.builtin.import_tasks: docker.yml - name: Install jq and bzip2 - apt: + ansible.builtin.apt: pkg: - jq - bzip2 - state: latest + state: present update_cache: true become: true -- name: check if autorestic is installed - stat: +- name: Check if autorestic is installed + ansible.builtin.stat: path: /usr/local/bin/autorestic register: autorestic_status - name: Install autorestic - when: not autorestic_status.stat.exists - shell: wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash + ansible.builtin.shell: set -o pipefail && wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash args: executable: /bin/bash + when: not autorestic_status.stat.exists + changed_when: true become: true -- name: check if restic is installed - stat: +- name: Check if restic is installed + ansible.builtin.stat: path: /usr/local/bin/restic register: restic_status - name: Install restic + ansible.builtin.command: autorestic install when: not restic_status.stat.exists - command: autorestic install + changed_when: true become: true diff --git a/roles/synapse/files/msrg.cc.log.config b/playbooks/roles/synapse/files/msrg.cc.log.config similarity index 100% rename from roles/synapse/files/msrg.cc.log.config rename to playbooks/roles/synapse/files/msrg.cc.log.config diff --git a/roles/synapse/tasks/main.yml b/playbooks/roles/synapse/tasks/main.yml similarity index 100% rename from roles/synapse/tasks/main.yml rename to playbooks/roles/synapse/tasks/main.yml diff --git a/roles/synapse/vars/main.yml b/playbooks/roles/synapse/vars/main.yml similarity index 100% rename from roles/synapse/vars/main.yml rename to playbooks/roles/synapse/vars/main.yml diff --git a/roles/tandoor/tasks/main.yml b/playbooks/roles/tandoor/tasks/main.yml similarity index 100% rename from roles/tandoor/tasks/main.yml rename to playbooks/roles/tandoor/tasks/main.yml diff --git a/roles/tandoor/vars/main.yml b/playbooks/roles/tandoor/vars/main.yml similarity index 100% rename from roles/tandoor/vars/main.yml rename to playbooks/roles/tandoor/vars/main.yml diff --git a/roles/teamspeak_fallback/files/teamspeak-fallback-db b/playbooks/roles/teamspeak_fallback/files/teamspeak-fallback-db similarity index 100% rename from roles/teamspeak_fallback/files/teamspeak-fallback-db rename to playbooks/roles/teamspeak_fallback/files/teamspeak-fallback-db diff --git a/roles/teamspeak_fallback/tasks/main.yml b/playbooks/roles/teamspeak_fallback/tasks/main.yml similarity index 100% rename from roles/teamspeak_fallback/tasks/main.yml rename to playbooks/roles/teamspeak_fallback/tasks/main.yml diff --git a/roles/teamspeak_fallback/templates/conditional-start.sh.j2 b/playbooks/roles/teamspeak_fallback/templates/conditional-start.sh.j2 similarity index 100% rename from roles/teamspeak_fallback/templates/conditional-start.sh.j2 rename to playbooks/roles/teamspeak_fallback/templates/conditional-start.sh.j2 diff --git a/roles/teamspeak_fallback/templates/teamspeak-fallback.service.j2 b/playbooks/roles/teamspeak_fallback/templates/teamspeak-fallback.service.j2 similarity index 100% rename from roles/teamspeak_fallback/templates/teamspeak-fallback.service.j2 rename to playbooks/roles/teamspeak_fallback/templates/teamspeak-fallback.service.j2 diff --git a/roles/teamspeak_fallback/vars/main.yml b/playbooks/roles/teamspeak_fallback/vars/main.yml similarity index 100% rename from roles/teamspeak_fallback/vars/main.yml rename to playbooks/roles/teamspeak_fallback/vars/main.yml diff --git a/roles/telegraf/tasks/main.yml b/playbooks/roles/telegraf/tasks/main.yml similarity index 100% rename from roles/telegraf/tasks/main.yml rename to playbooks/roles/telegraf/tasks/main.yml diff --git a/roles/telegraf/templates/telegraf.conf.j2 b/playbooks/roles/telegraf/templates/telegraf.conf.j2 similarity index 100% rename from roles/telegraf/templates/telegraf.conf.j2 rename to playbooks/roles/telegraf/templates/telegraf.conf.j2 diff --git a/roles/telegraf/vars/main.yml b/playbooks/roles/telegraf/vars/main.yml similarity index 100% rename from roles/telegraf/vars/main.yml rename to playbooks/roles/telegraf/vars/main.yml diff --git a/roles/tinytinyrss/tasks/main.yml b/playbooks/roles/tinytinyrss/tasks/main.yml similarity index 100% rename from roles/tinytinyrss/tasks/main.yml rename to playbooks/roles/tinytinyrss/tasks/main.yml diff --git a/roles/tinytinyrss/vars/main.yml b/playbooks/roles/tinytinyrss/vars/main.yml similarity index 100% rename from roles/tinytinyrss/vars/main.yml rename to playbooks/roles/tinytinyrss/vars/main.yml diff --git a/roles/umami/tasks/main.yml b/playbooks/roles/umami/tasks/main.yml similarity index 100% rename from roles/umami/tasks/main.yml rename to playbooks/roles/umami/tasks/main.yml diff --git a/roles/umami/vars/main.yml b/playbooks/roles/umami/vars/main.yml similarity index 100% rename from roles/umami/vars/main.yml rename to playbooks/roles/umami/vars/main.yml diff --git a/roles/vikunja/tasks/main.yml b/playbooks/roles/vikunja/tasks/main.yml similarity index 100% rename from roles/vikunja/tasks/main.yml rename to playbooks/roles/vikunja/tasks/main.yml diff --git a/roles/vikunja/vars/main.yml b/playbooks/roles/vikunja/vars/main.yml similarity index 100% rename from roles/vikunja/vars/main.yml rename to playbooks/roles/vikunja/vars/main.yml diff --git a/roles/watchtower/files/run-once.sh b/playbooks/roles/watchtower/files/run-once.sh similarity index 100% rename from roles/watchtower/files/run-once.sh rename to playbooks/roles/watchtower/files/run-once.sh diff --git a/roles/watchtower/tasks/main.yml b/playbooks/roles/watchtower/tasks/main.yml similarity index 100% rename from roles/watchtower/tasks/main.yml rename to playbooks/roles/watchtower/tasks/main.yml diff --git a/roles/watchtower/vars/main.yml b/playbooks/roles/watchtower/vars/main.yml similarity index 100% rename from roles/watchtower/vars/main.yml rename to playbooks/roles/watchtower/vars/main.yml diff --git a/roles/wiki_js/tasks/main.yml b/playbooks/roles/wiki_js/tasks/main.yml similarity index 100% rename from roles/wiki_js/tasks/main.yml rename to playbooks/roles/wiki_js/tasks/main.yml diff --git a/roles/wiki_js/vars/main.yml b/playbooks/roles/wiki_js/vars/main.yml similarity index 100% rename from roles/wiki_js/vars/main.yml rename to playbooks/roles/wiki_js/vars/main.yml diff --git a/roles/woodpecker/tasks/main.yml b/playbooks/roles/woodpecker/tasks/main.yml similarity index 100% rename from roles/woodpecker/tasks/main.yml rename to playbooks/roles/woodpecker/tasks/main.yml diff --git a/roles/woodpecker/vars/main.yml b/playbooks/roles/woodpecker/vars/main.yml similarity index 100% rename from roles/woodpecker/vars/main.yml rename to playbooks/roles/woodpecker/vars/main.yml diff --git a/playbooks/tasks/reload-caddy.yml b/playbooks/tasks/reload-caddy.yml index ea20885..bf2ee32 100644 --- a/playbooks/tasks/reload-caddy.yml +++ b/playbooks/tasks/reload-caddy.yml @@ -1,7 +1,7 @@ - name: Find existing caddy site configs ansible.builtin.find: paths: "{{ caddy_config_path }}" - recurse: no + recurse: false register: find_result - name: Map exisiting/wanted caddy site configs ansible.builtin.set_fact: diff --git a/playbooks/tasks/stop-unused.yml b/playbooks/tasks/stop-unused.yml index 0cd8b11..e51d00a 100644 --- a/playbooks/tasks/stop-unused.yml +++ b/playbooks/tasks/stop-unused.yml @@ -1,6 +1,13 @@ - name: Get running compose projects ansible.builtin.shell: - cmd: docker container ls --format json | jq .Labels | grep -oe 'com.docker.compose.project=[a-zA-Z0-9_-]*' | sed -e 's/com.docker.compose.project=//' | sort | uniq + cmd: | + set -o pipefail + docker container ls --format json \ + | jq .Labels \ + | grep -oe 'com.docker.compose.project=[a-zA-Z0-9_-]*' \ + | sed -e 's/com.docker.compose.project=//' \ + | sort \ + | uniq changed_when: false register: docker_compose_projects_result @@ -14,4 +21,3 @@ chdir: "{{ (services_path, item) | path_join }}" changed_when: true loop: "{{ unused_services }}" -