--- - name: Install python3-pip apt: name: python3-pip state: present register: result until: result is succeeded - name: Remove docker-py python module pip: name: docker-py state: absent register: result until: result is succeeded - name: Install docker python module pip: name: docker state: present register: result until: result is succeeded - name: Create Docker home directory file: path: "{{ docker_home }}" mode: 0755 state: directory - name: Add user account to Docker group user: name: "{{ ansible_nas_user }}" groups: docker append: yes - name: Generate Docker daemon.json copy: dest: /etc/docker/daemon.json content: "{{ docker_daemon_json | to_nice_json }}" register: docker_config - name: Restart Docker # noqa no-handler service: name: docker state: restarted when: docker_config.changed