- name: Restore docker daemon configuration when: daemon_config_stat.stat.exists command: "cp {{ workspace }}/docker-daemon.json /etc/docker/daemon.json" become: true - name: Remove docker daemon configuration when: not daemon_config_stat.stat.exists command: "rm /etc/docker/daemon.json" become: true - name: Restart docker daemon service: name: docker state: restarted become: true register: docker_restart failed_when: docker_restart is failed and not 'Could not find the requested service' in docker_restart.msg - name: Restore docker user configuration when: user_config_stat.stat.exists command: "cp {{ workspace }}/docker-user.json ~/.docker/config.json" - name: Remove docker user configuration when: not user_config_stat.stat.exists command: "rm ~/.docker/config.json" - name: Restore registries.conf when: registries_conf_stat.stat.exists command: "cp {{ workspace }}/registries.conf /etc/containers/registries.conf" become: true - name: Remove registries.conf when: not registries_conf_stat.stat.exists command: "rm /etc/containers/registries.conf" become: true - name: Restore containers user auth when: containers_auth_stat.stat.exists command: "cp {{ workspace }}/containers-auth.json /run/user/{{ ansible_user_uid }}/auth.json" - name: Remove containers user auth when: not containers_auth_stat.stat.exists command: "rm /run/user/{{ ansible_user_uid }}/auth.json"