mirror of
https://github.com/Maks1mS/ansible-role-docker.git
synced 2024-12-24 00:33:04 +03:00
0884ae21b8
Why: Without this modification, we can't use docker with docker_users in same playbook than the one which install docker. How: Check that docker_users are set and not in docker group before include docker-users.yml. In docker-users.yml we call reset_connection from ansible.builtin.meta collection after docker-users are added to docker group. Manual success tests: * Try to install docker with only one user in docker-users and not in docker group => docker-users.yml include * Try to install docker with only one user in docker-users but the user is in docker group => docker-users.yml not include * Try to install docker with 2 users in docker-users, one user in docker group and the second not => docker-users.yml include * Try to install docker with 2 users in docker-users, both are in docker group => docker-users.yml not include * Try to install docker with 2 users in docker-users, both are not in docker group => docker-users.yml include
12 lines
247 B
YAML
12 lines
247 B
YAML
---
|
|
- name: Ensure docker users are added to the docker group.
|
|
user:
|
|
name: "{{ item }}"
|
|
groups: docker
|
|
append: true
|
|
with_items: "{{ docker_users }}"
|
|
|
|
- name: Reset ssh connection to apply users changes
|
|
meta:
|
|
reset_connection
|