diff --git a/purge-docker-cluster.yml b/purge-docker-cluster.yml index 82961383c..3f33cbdac 100644 --- a/purge-docker-cluster.yml +++ b/purge-docker-cluster.yml @@ -361,11 +361,36 @@ enabled: no when: not is_atomic + - name: remove docker-py + pip: + name: docker-py + version: 1.1.0 + state: absent + when: + ansible_version['full'] | version_compare('2.1.0.0', '<') and + not is_atomic + + - name: remove docker-py + pip: + name: docker-py + state: absent + when: + ansible_version['full'] | version_compare('2.1.0.0', '>=') and + not is_atomic + + - name: remove six + pip: + name: six + version: 1.9.0 + state: absent + when: not is_atomic + - name: remove pip and docker on ubuntu apt: name: "{{ item }}" state: absent update_cache: yes + autoremove: yes with_items: - python-pip - docker @@ -377,6 +402,7 @@ name: "{{ item }}" state: absent update_cache: yes + autoremove: yes with_items: - python-pip - docker-engine @@ -411,7 +437,6 @@ ansible_os_family == 'RedHat' and ansible_pkg_mgr == "yum" and not is_atomic - failed_when: false # for CentOS - name: remove docker on redhat @@ -424,7 +449,6 @@ ansible_os_family == 'RedHat' and ansible_pkg_mgr == "yum" and not is_atomic - failed_when: false - name: remove pip and docker on redhat dnf: @@ -439,28 +463,32 @@ ansible_pkg_mgr == "dnf" and not is_atomic - - name: remove six - pip: - name: six - version: 1.9.0 - state: absent - when: not is_atomic - - - name: remove docker-py - pip: - name: docker-py - version: 1.1.0 - state: absent + - name: remove package dependencies on redhat + command: yum -y autoremove when: - ansible_version['full'] | version_compare('2.1.0.0', '<') and + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" and not is_atomic - - name: remove docker-py - pip: - name: docker-py - state: absent + - name: remove package dependencies on redhat again + command: yum -y autoremove when: - ansible_version['full'] | version_compare('2.1.0.0', '>=') and + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "yum" and + not is_atomic + + - name: remove package dependencies on redhat + command: dnf -y autoremove + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" and + not is_atomic + + - name: remove package dependencies on redhat again + command: dnf -y autoremove + when: + ansible_os_family == 'RedHat' and + ansible_pkg_mgr == "dnf" and not is_atomic