From ae7b65cc5f4a35846b3b51fb039fc01c25d33d29 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 18:53:03 +0100 Subject: [PATCH] :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