--- - name: Ensure group "docker" exists ansible.builtin.group: name: docker state: present become: true - name: Append the group docker to "{{ user }}" ansible.builtin.user: name: "{{ user }}" shell: /bin/bash groups: docker append: true become: true