--- - name: Ensure group "docker" exists group: name: docker state: present become: yes - name: Append the group "docker" to "{{ user }}" groups ansible.builtin.user: name: "{{ user }}" shell: /bin/bash groups: docker append: yes become: yes - name: Make sure that the docker folders exists ansible.builtin.file: path: "{{ item }}" owner: "{{ user }}" group: "{{ user }}" state: directory loop: - "{{docker_compose_dir}}" - "{{docker_dir}}" become: yes