From 05c7690b8388a37355920a13f27ee4da802c8a11 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 26 Apr 2020 13:44:06 +0100 Subject: [PATCH] Make `grimes` a docker host --- ansible/main.yml | 12 +++++++++++- ansible/roles/docker-cleanup/tasks/main.yml | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ansible/main.yml b/ansible/main.yml index 83626d9..f7eb9c8 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -11,16 +11,26 @@ roles: - gateway -- hosts: intersect +- hosts: + - intersect + - grimes roles: - role: geerlingguy.docker become: true vars: docker_install_compose: false # This role installs the binary directly, which is kinda nasty + docker_package: "{{ 'docker-ce' if ansible_os_family == 'Debian' else 'docker' }}" docker_users: - "{{ user }}" - docker-cleanup + +- hosts: intersect + roles: - netdata - traefik - watchtower - docker + +- hosts: grimes + roles: + - netdata diff --git a/ansible/roles/docker-cleanup/tasks/main.yml b/ansible/roles/docker-cleanup/tasks/main.yml index 9a2e0d1..e5c7c9f 100644 --- a/ansible/roles/docker-cleanup/tasks/main.yml +++ b/ansible/roles/docker-cleanup/tasks/main.yml @@ -3,18 +3,27 @@ name: docker-compose become: true +- name: Ensure group "somegroup" exists + group: + name: "{{ docker_user.name }}" + state: present + gid: "{{ docker_user.id }}" + become: true + - name: Create docker user user: name: "{{ docker_user.name }}" uid: "{{ docker_user.id }}" group: "{{ docker_user.name }}" create_home: false + become: true - name: Add user to docker user group user: name: "{{ user }}" groups: "{{ docker_user.name }}" append: true + become: true - name: Clean up docker containers cron: