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.
This commit is contained in:
June 2023-07-30 06:57:30 +02:00 committed by julian
parent 042ff7c2ec
commit 317c822ab5
13 changed files with 125 additions and 68 deletions

View file

@ -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:

71
playbooks/deploy.yaml Normal file
View file

@ -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

View file

@ -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

View file

@ -1,7 +0,0 @@
---
- name: Deploy esphome on esphome.z9
hosts: esphome
roles:
- esphome
- cert
- nginx

View file

@ -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

View file

@ -1,7 +0,0 @@
---
- name: Deploy ola and foobazdmx on light.z9
hosts: light
roles:
- ola
- foobazdmx
- nginx

View file

@ -1,5 +0,0 @@
---
- name: Deploy stuff on mailserver-endpoint.ccchh.net
hosts: mailserver-endpoint
roles:
- deploy_ssh_server_config

View file

@ -1,5 +0,0 @@
---
- name: Deploy mosquitto MQTT broker on mqtt.z9.ccchh.net
hosts: mqtt
roles:
- mosquitto

View file

@ -1,5 +0,0 @@
---
- name: Deploy the Public-Reverse-Proxy
hosts: public-reverse-proxy
roles:
- nginx

View file

@ -1,6 +0,0 @@
---
- name: Deploy the Send-Only-Mailserver
hosts: send-only-mailserver
become: true
roles:
- send_only_mail_server

View file

@ -1,7 +0,0 @@
---
- name: Deploy zigbee2mqtt on zigbee2mqtt.z9.ccchh.net
hosts: zigbee2mqtt
roles:
- zigbee2mqtt
- cert
- nginx

View file

@ -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

View file

@ -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"
dest: "{{ ansible_user_dir }}/engelsystem/resources/lang/de_DE/default.po"