From eb76c93ae56919d7ff9c24cbb5e96fe7d4ba773a Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sun, 13 Oct 2024 20:31:23 +0200 Subject: [PATCH] Cleanup playbooks --- inventory/group_vars/all/main.yml | 8 +++++++- playbooks/local-dev.yml | 27 --------------------------- playbooks/serguzim.net.yml | 19 +++---------------- 3 files changed, 10 insertions(+), 44 deletions(-) delete mode 100644 playbooks/local-dev.yml diff --git a/inventory/group_vars/all/main.yml b/inventory/group_vars/all/main.yml index 91ede79..b21e7c7 100644 --- a/inventory/group_vars/all/main.yml +++ b/inventory/group_vars/all/main.yml @@ -19,8 +19,14 @@ container_registry: services_path: /opt/services/ +common_services: + - always + - backup + - lego + - caddy + - watchtower + caddy_path: "{{ (services_path, 'caddy') | path_join }}" caddy_config_path: "{{ (caddy_path, 'config', 'conf.d') | path_join }}" -managed_sites: [] certificates_path: "{{ (services_path, '_certificates') | path_join }}" diff --git a/playbooks/local-dev.yml b/playbooks/local-dev.yml deleted file mode 100644 index b16b64c..0000000 --- a/playbooks/local-dev.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Run roles for local-dev - vars: - # Remove inventory - base_path: "{{ inventory_dir.split('/')[0:-1] | join('/') }}" - services_path: "{{ (base_path, '_services') | path_join }}" - caddy_config_path: "{{ (services_path, 'caddy', 'config', 'conf.d') | path_join }}" - - hosts: local-dev - roles: - - common - - - acme-dns - - faas - - forgejo - - forgejo-runner - - healthcheck - - homebox - - influxdb - - jellyfin - - tandoor - - telegraf - - tinytinyrss - - umami - - uptime-kuma - - watchtower - - wiki-js diff --git a/playbooks/serguzim.net.yml b/playbooks/serguzim.net.yml index 1ee6917..c75d9c2 100644 --- a/playbooks/serguzim.net.yml +++ b/playbooks/serguzim.net.yml @@ -1,6 +1,8 @@ --- - name: Run all roles hosts: serguzim_net + vars: + host_services: "{{ all_services | my_service_attributes(inventory_hostname) | union(common_services) }}" tasks: - name: Install software ansible.builtin.include_role: @@ -10,28 +12,13 @@ tags: software when: "inventory_hostname == 'node003'" - - name: Include common roles - ansible.builtin.include_role: - name: "{{ services_item }}" - apply: - tags: "{{ services_item }}" - tags: always - loop: - - always - - backup - - lego - - caddy - - watchtower - loop_control: - loop_var: services_item - - name: Include service roles ansible.builtin.include_role: name: "{{ services_item }}" apply: tags: "{{ services_item }}" tags: always - loop: "{{ all_services | my_service_attributes(inventory_hostname) }}" + loop: "{{ host_services }}" loop_control: loop_var: services_item