Merge pull request #370 from fardke/reset-ssh-connection-after-docker-install

reset ssh connection to allow user changes to affect current login user
This commit is contained in:
Jeff Geerling 2022-09-05 21:30:55 -05:00 committed by GitHub
commit 9f8ea35051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -5,3 +5,7 @@
groups: docker groups: docker
append: true append: true
with_items: "{{ docker_users }}" with_items: "{{ docker_users }}"
- name: Reset ssh connection to apply users changes
meta:
reset_connection

View File

@ -79,5 +79,20 @@
- include_tasks: docker-compose.yml - include_tasks: docker-compose.yml
when: docker_install_compose | bool when: docker_install_compose | bool
- include_tasks: docker-users.yml - name: Get all docker group infos
getent:
database: group
key: docker
split: ':'
when: docker_users | length > 0 when: docker_users | length > 0
- name: Check there is at least one user to add to docker group
set_fact:
at_least_one_user_to_modify: true
when:
- docker_users | length > 0
- item not in ansible_facts.getent_group["docker"][2]
with_items: "{{ docker_users }}"
- include_tasks: docker-users.yml
when: at_least_one_user_to_modify is defined