geerlingguy / ansible-role-docker

Ansible Role - Docker
https://galaxy.ansible.com/geerlingguy/docker/
MIT License
1.81k stars 853 forks source link

"docker" group is not created by this role and due to is failing #397

Closed jakuboskera closed 1 year ago

jakuboskera commented 1 year ago

This role is failing when I run it against VM Ubuntu 18.04 where is not created group "docker". As this role isn't create this group, it cannot procesed this task Get docker group info using getent, because it expects that key (group) "docker" already exists.

TASK [geerlingguy.docker : Get docker group info using getent.] ****************
fatal: [host-1]: FAILED! => {"changed": false, "msg": "One or more supplied key could not be found in the database."}
jakuboskera commented 1 year ago

I was wrong, I ran ansible-playbook command with --check option, and this will not create prereqs.

knightdave commented 1 year ago

Hi! I'd like to reopen this issue. Task "Get docker group info using getent" could have have additional parameter ignore_errors: "{{ ansible_check_mode }}" like below to properly work on --check mode.

- name: Get docker group info using getent.
  getent:
    database: group
    key: docker
    split: ':'
  ignore_errors: "{{ ansible_check_mode }}"
  when: docker_users | length > 0

This task is always failing on check mode if docker was not installed in some way before and docker group doesn't exists during playbook run.