From 317c822ab59dfdd3013a317e8318ccbee145b934 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 30 Jul 2023 06:57:30 +0200 Subject: [PATCH] Combine playbooks for indiviual hosts into one playbook This makes a full deployment of all hosts easier and parallelises execution of roles, which are used for multiple hosts. You can still easily deploy only a subset of hosts using the -l flag for ansible-playbook. --- inventories/z9/hosts.yaml | 51 +++++++++++++ playbooks/deploy.yaml | 71 +++++++++++++++++++ playbooks/deploy_audio_pi.yaml | 7 -- playbooks/deploy_esphome.yaml | 7 -- playbooks/deploy_keycloak.yaml | 8 --- playbooks/deploy_light.yaml | 7 -- playbooks/deploy_mailserver_endpoint.yaml | 5 -- playbooks/deploy_mqtt.yaml | 5 -- playbooks/deploy_public_reverse_proxy.yaml | 5 -- playbooks/deploy_send_only_mailserver.yaml | 6 -- playbooks/deploy_zigbee2mqtt.yaml | 7 -- ...wiki.yaml => dokuwiki_specific_tasks.yaml} | 5 +- ...ml => engelsystem_specific_pre_tasks.yaml} | 9 +-- 13 files changed, 125 insertions(+), 68 deletions(-) create mode 100644 playbooks/deploy.yaml delete mode 100644 playbooks/deploy_audio_pi.yaml delete mode 100644 playbooks/deploy_esphome.yaml delete mode 100644 playbooks/deploy_keycloak.yaml delete mode 100644 playbooks/deploy_light.yaml delete mode 100644 playbooks/deploy_mailserver_endpoint.yaml delete mode 100644 playbooks/deploy_mqtt.yaml delete mode 100644 playbooks/deploy_public_reverse_proxy.yaml delete mode 100644 playbooks/deploy_send_only_mailserver.yaml delete mode 100644 playbooks/deploy_zigbee2mqtt.yaml rename playbooks/{deploy_dokuwiki.yaml => dokuwiki_specific_tasks.yaml} (92%) rename playbooks/{deploy_engelsystem.yaml => engelsystem_specific_pre_tasks.yaml} (85%) diff --git a/inventories/z9/hosts.yaml b/inventories/z9/hosts.yaml index 95d0de8..2c75c50 100644 --- a/inventories/z9/hosts.yaml +++ b/inventories/z9/hosts.yaml @@ -40,3 +40,54 @@ all: keycloak: ansible_host: keycloak.z9.ccchh.net ansible_user: chaos + nginx_hosts: + hosts: + public-reverse-proxy: + esphome: + zigbee2mqtt: + light: + keycloak: + wiki: + engelsystem: + cert_hosts: + hosts: + esphome: + zigbee2mqtt: + keycloak: + wiki: + engelsystem: + ssh_server_config_hosts: + hosts: + keycloak: + mailserver-endpoint: + docker_compose_hosts: + hosts: + keycloak: + engelsystem: + esphome_hosts: + hosts: + esphome: + zigbee2mqtt_hosts: + hosts: + zigbee2mqtt: + mosquitto_hosts: + hosts: + mqtt: + ola_hosts: + hosts: + light: + foobazdmx_hosts: + hosts: + light: + hifiberry_hosts: + hosts: + audio: + bluetooth_audio_sink_hosts: + hosts: + audio: + shairport_sync_hosts: + hosts: + audio: + send_only_mail_server_hosts: + hosts: + send-only-mailserver: diff --git a/playbooks/deploy.yaml b/playbooks/deploy.yaml new file mode 100644 index 0000000..bb078cc --- /dev/null +++ b/playbooks/deploy.yaml @@ -0,0 +1,71 @@ +--- +- name: engelsystem_specific_pre_tasks + ansible.builtin.import_playbook: engelsystem_specific_pre_tasks.yaml + +- name: Ensure SSH server config deployment on ssh_server_config_hosts + hosts: ssh_server_config_hosts + roles: + - deploy_ssh_server_config + +- name: Ensure Send-Only-Mailserver deployment on send_only_mail_server_hosts + hosts: send_only_mail_server_hosts + roles: + - send_only_mail_server + +- name: Ensure HiFiBerry deployment on hifiberry_hosts + hosts: hifiberry_hosts + roles: + - hifiberry + +- name: Ensure bluetooth audio sink deployment on bluetooth_audio_sink_hosts + hosts: bluetooth_audio_sink_hosts + roles: + - bluetooth_audio_sink + +- name: Ensure shairport sync deployment on shairport_sync_hosts + hosts: shairport_sync_hosts + roles: + - shairport_sync + +- name: Ensure ola deployment on ola_hosts + hosts: ola_hosts + roles: + - ola + +- name: Ensure foobazdmx deployment on foobazdmx_hosts + hosts: foobazdmx_hosts + roles: + - foobazdmx + +- name: Ensure Mosquitto MQTT broker deployment on mosquitto_hosts + hosts: mosquitto_hosts + roles: + - mosquitto + +- name: Ensure ESPHome deployment on esphome_hosts + hosts: esphome_hosts + roles: + - esphome + +- name: Ensure Zigbee2MQTT deployment on zigbee2mqtt_hosts + hosts: zigbee2mqtt_hosts + roles: + - zigbee2mqtt + +- name: Ensure certificate deployment on cert_hosts + hosts: cert_hosts + roles: + - cert + +- name: Ensure Docker Compose deployment on docker_compose_hosts + hosts: docker_compose_hosts + roles: + - docker_compose + +- name: Ensure NGINX deployment on nginx_hosts + hosts: nginx_hosts + roles: + - nginx + +- name: dokuwiki_specific_tasks + ansible.builtin.import_playbook: dokuwiki_specific_tasks.yaml diff --git a/playbooks/deploy_audio_pi.yaml b/playbooks/deploy_audio_pi.yaml deleted file mode 100644 index 5c6c02f..0000000 --- a/playbooks/deploy_audio_pi.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Configure audio.z9 as a bluetooth audio sink and AirPlay server - hosts: audio - roles: - - hifiberry - - bluetooth_audio_sink - - shairport_sync diff --git a/playbooks/deploy_esphome.yaml b/playbooks/deploy_esphome.yaml deleted file mode 100644 index 87d9663..0000000 --- a/playbooks/deploy_esphome.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Deploy esphome on esphome.z9 - hosts: esphome - roles: - - esphome - - cert - - nginx diff --git a/playbooks/deploy_keycloak.yaml b/playbooks/deploy_keycloak.yaml deleted file mode 100644 index baaff50..0000000 --- a/playbooks/deploy_keycloak.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Deploy nginx and keycloak using docker_compose on keyloak - hosts: keycloak - roles: - - deploy_ssh_server_config - - cert - - docker_compose - - nginx diff --git a/playbooks/deploy_light.yaml b/playbooks/deploy_light.yaml deleted file mode 100644 index 2f6efe6..0000000 --- a/playbooks/deploy_light.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Deploy ola and foobazdmx on light.z9 - hosts: light - roles: - - ola - - foobazdmx - - nginx diff --git a/playbooks/deploy_mailserver_endpoint.yaml b/playbooks/deploy_mailserver_endpoint.yaml deleted file mode 100644 index f59b939..0000000 --- a/playbooks/deploy_mailserver_endpoint.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Deploy stuff on mailserver-endpoint.ccchh.net - hosts: mailserver-endpoint - roles: - - deploy_ssh_server_config diff --git a/playbooks/deploy_mqtt.yaml b/playbooks/deploy_mqtt.yaml deleted file mode 100644 index af433a3..0000000 --- a/playbooks/deploy_mqtt.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Deploy mosquitto MQTT broker on mqtt.z9.ccchh.net - hosts: mqtt - roles: - - mosquitto diff --git a/playbooks/deploy_public_reverse_proxy.yaml b/playbooks/deploy_public_reverse_proxy.yaml deleted file mode 100644 index e0bf99f..0000000 --- a/playbooks/deploy_public_reverse_proxy.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- name: Deploy the Public-Reverse-Proxy - hosts: public-reverse-proxy - roles: - - nginx diff --git a/playbooks/deploy_send_only_mailserver.yaml b/playbooks/deploy_send_only_mailserver.yaml deleted file mode 100644 index 3fd9667..0000000 --- a/playbooks/deploy_send_only_mailserver.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Deploy the Send-Only-Mailserver - hosts: send-only-mailserver - become: true - roles: - - send_only_mail_server diff --git a/playbooks/deploy_zigbee2mqtt.yaml b/playbooks/deploy_zigbee2mqtt.yaml deleted file mode 100644 index bcdb377..0000000 --- a/playbooks/deploy_zigbee2mqtt.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Deploy zigbee2mqtt on zigbee2mqtt.z9.ccchh.net - hosts: zigbee2mqtt - roles: - - zigbee2mqtt - - cert - - nginx diff --git a/playbooks/deploy_dokuwiki.yaml b/playbooks/dokuwiki_specific_tasks.yaml similarity index 92% rename from playbooks/deploy_dokuwiki.yaml rename to playbooks/dokuwiki_specific_tasks.yaml index f328015..db9b89d 100644 --- a/playbooks/deploy_dokuwiki.yaml +++ b/playbooks/dokuwiki_specific_tasks.yaml @@ -1,9 +1,6 @@ --- -- name: Configure wiki.z9 with dokuwiki +- name: dokuwiki on wiki.z9 specific tasks hosts: wiki - roles: - - nginx - - cert tasks: # TODO: make this a role - name: Install php-fpm diff --git a/playbooks/deploy_engelsystem.yaml b/playbooks/engelsystem_specific_pre_tasks.yaml similarity index 85% rename from playbooks/deploy_engelsystem.yaml rename to playbooks/engelsystem_specific_pre_tasks.yaml index 80df811..b7a57b1 100644 --- a/playbooks/deploy_engelsystem.yaml +++ b/playbooks/engelsystem_specific_pre_tasks.yaml @@ -1,11 +1,6 @@ --- -- name: Configure engelsystem.z9 with engelsystem +- name: engelsystem on engelsystem.z9 specific pre tasks hosts: engelsystem - roles: - - nginx - - cert - - docker - - docker_compose pre_tasks: - name: Install git ansible.builtin.apt: @@ -25,4 +20,4 @@ - name: apply patch to german locale add train drivers license ansible.posix.patch: src: patches/engelsystem/lang_de.patch - dest: "{{ ansible_user_dir }}/engelsystem/resources/lang/de_DE/default.po" \ No newline at end of file + dest: "{{ ansible_user_dir }}/engelsystem/resources/lang/de_DE/default.po"