From ab08f1daa1ea70522a8379deb2c8508435d2e910 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 18:32:43 +0100 Subject: [PATCH 1/3] :art: inventory: Sort entries Makes it easier to compare different groups against each other. --- inventory.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/inventory.yml b/inventory.yml index 8efd97a..ece7fa4 100644 --- a/inventory.yml +++ b/inventory.yml @@ -3,36 +3,36 @@ all: hosts: tau.netz39.de: beaker.n39.eu: - pottwal.n39.eu: - unicorn.n39.eu: - platon.n39.eu: - radon.n39.eu: + hobbes.n39.eu: + holmium.n39.eu: krypton.n39.eu: oganesson.n39.eu: - holmium.n39.eu: - hobbes.n39.eu: + platon.n39.eu: + pottwal.n39.eu: + radon.n39.eu: + unicorn.n39.eu: children: proxmox: hosts: - pottwal.n39.eu: - unicorn.n39.eu: - radon.n39.eu: + holmium.n39.eu: krypton.n39.eu: oganesson.n39.eu: - holmium.n39.eu: + pottwal.n39.eu: + radon.n39.eu: + unicorn.n39.eu: ssh_jump: hosts: - pottwal.n39.eu: - unicorn.n39.eu: - radon.n39.eu: + beaker.n39.eu: + hobbes.n39.eu: + holmium.n39.eu: krypton.n39.eu: oganesson.n39.eu: - holmium.n39.eu: platon.n39.eu: - beaker.n39.eu: + pottwal.n39.eu: + radon.n39.eu: wittgenstein.n39.eu: - hobbes.n39.eu: + unicorn.n39.eu: ssh_no_jump: hosts: tau.netz39.de: From 083bab14e82cdbc86ed91859ae45c371ea7fae43 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 18:38:02 +0100 Subject: [PATCH 2/3] :wrench: inventory: Introduce new group 'docker_host' Hosts which have Docker installed and where containers can run. Might make it easier to deploy a unified setup on each of them. --- inventory.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inventory.yml b/inventory.yml index ece7fa4..e7c8c54 100644 --- a/inventory.yml +++ b/inventory.yml @@ -13,6 +13,13 @@ all: unicorn.n39.eu: children: + docker_host: + hosts: + krypton.n39.eu: + pottwal.n39.eu: + radon.n39.eu: + tau.netz39.de: + unicorn.n39.eu: proxmox: hosts: holmium.n39.eu: From ae7b65cc5f4a35846b3b51fb039fc01c25d33d29 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 18:53:03 +0100 Subject: [PATCH 3/3] :wrench: Move docker_setup role application to group playbook To install docker on a host you have to put it into that group in inventory now, instead of adding the role to each host playbook. Idea is to extend the group docker_host playbook by more docker related things as for example metrics and monitoring. --- group-docker_host.yml | 6 ++++++ group_vars/docker_host/vars.yml | 2 ++ host-krypton.yml | 4 +--- host-pottwal.yml | 4 +--- host-radon.yml | 4 +--- host-tau.yml | 2 +- host-unicorn.yml | 6 +++--- host_vars/tau.netz39.de/vars.yml | 1 + main.yml | 3 +++ 9 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 group-docker_host.yml create mode 100644 group_vars/docker_host/vars.yml diff --git a/group-docker_host.yml b/group-docker_host.yml new file mode 100644 index 0000000..7a338c0 --- /dev/null +++ b/group-docker_host.yml @@ -0,0 +1,6 @@ +--- +- hosts: docker_host + become: true + + roles: + - role: docker_setup diff --git a/group_vars/docker_host/vars.yml b/group_vars/docker_host/vars.yml new file mode 100644 index 0000000..2978231 --- /dev/null +++ b/group_vars/docker_host/vars.yml @@ -0,0 +1,2 @@ +--- +docker_data_root: "/srv/docker" diff --git a/host-krypton.yml b/host-krypton.yml index 045204f..53204f8 100644 --- a/host-krypton.yml +++ b/host-krypton.yml @@ -20,9 +20,7 @@ roles: - - role: docker_setup - vars: - docker_data_root: "/srv/docker" + # role 'docker_setup' applied through group 'docker_host' - role: apache - role: apache_letsencrypt # Uses configuration from dehydrated setup - role: ansible-role-dehydrated diff --git a/host-pottwal.yml b/host-pottwal.yml index 421bf5d..4d910f0 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -3,9 +3,7 @@ become: true roles: - - role: docker_setup - vars: - docker_data_root: "/srv/docker" + # role 'docker_setup' applied through group 'docker_host' - role: apache - role: apache_letsencrypt # Uses configuration from dehydrated setup - role: ansible-role-dehydrated diff --git a/host-radon.yml b/host-radon.yml index 4adf085..f1e305e 100644 --- a/host-radon.yml +++ b/host-radon.yml @@ -22,9 +22,7 @@ brotherql_web_image: "pklaus/brother_ql_web:alpine_9e20b6d" roles: - - role: docker_setup - vars: - docker_data_root: "/srv/docker" + # role 'docker_setup' applied through group 'docker_host' - role: apache - role: apache_letsencrypt # Uses configuration from dehydrated setup - role: ansible-role-dehydrated diff --git a/host-tau.yml b/host-tau.yml index a9ace8c..09f6926 100644 --- a/host-tau.yml +++ b/host-tau.yml @@ -17,7 +17,7 @@ dokuwiki_image: "bitnami/dokuwiki:20220731@sha256:989ab52cf2d2e0f84166e114ca4ce88f59546b8f6d34958905f8d81c18cbd759" roles: - - role: docker_setup + # role 'docker_setup' applied through group 'docker_host' - role: apache - role: penguineer.dehydrated_cron diff --git a/host-unicorn.yml b/host-unicorn.yml index 781a8bc..2780230 100644 --- a/host-unicorn.yml +++ b/host-unicorn.yml @@ -5,10 +5,10 @@ vars: ansible_python_interpreter: /usr/bin/python3 data_dir: "/srv/data" + roles: - - role: docker_setup - vars: - docker_data_root: "/srv/docker" + # role 'docker_setup' applied through group 'docker_host' + tasks: - name: Setup the docker container for unifi-controller docker_container: diff --git a/host_vars/tau.netz39.de/vars.yml b/host_vars/tau.netz39.de/vars.yml index 7fb2b4d..d875ed9 100644 --- a/host_vars/tau.netz39.de/vars.yml +++ b/host_vars/tau.netz39.de/vars.yml @@ -1,3 +1,4 @@ --- server_admin: "admin+tau@netz39.de" mysql_root_pw: "{{ vault_mysql_root_pw }}" +docker_data_root: "/var/lib/docker" diff --git a/main.yml b/main.yml index 03db3b3..785175b 100644 --- a/main.yml +++ b/main.yml @@ -7,6 +7,9 @@ - name: Specific setup for all proxmox hosts import_playbook: group-proxmox.yml +- name: Specific setup for all docker host hosts + import_playbook: group-docker_host.yml + - name: Tau specific setup import_playbook: host-tau.yml