From: Guillaume Abrioux Date: Fri, 1 Mar 2019 13:45:48 +0000 (+0100) Subject: purge: do not remove /var/lib/apt/lists/* X-Git-Tag: v4.0.0rc1~61 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3849f30f58e35d559bfa137fa301214192db993b;p=ceph-ansible.git purge: do not remove /var/lib/apt/lists/* removing the content of this directory seems a bit agressive and cause a redeployment to fail after a purge on debian based distrubition. Typical error: ``` fatal: [mon0]: FAILED! => changed=false attempts: 3 msg: No package matching 'ceph' is available ``` The following task will consider the cache is still valid, so apt doesn't refresh it: ``` - name: update apt cache if cache_valid_time has expired apt: update_cache: yes cache_valid_time: 3600 register: result until: result is succeeded ``` since the task installing ceph packages has a `update_cache: no` it fails: ``` - name: install ceph for debian apt: name: "{{ debian_ceph_pkgs | unique }}" update_cache: no state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" default_release: "{{ ceph_stable_release_uca | default('') }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else '' }}" register: result until: result is succeeded ``` /tmp/* isn't specific to ceph as well, so we shouldn't remove everything in this directory. Signed-off-by: Guillaume Abrioux --- diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 588d6b2ff..aa7a6e365 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -573,7 +573,7 @@ state: absent - name: clean apt - shell: apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + command: apt-get clean when: ansible_pkg_mgr == 'apt' - name: purge rh_storage.repo file in /etc/yum.repos.d