]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge: do not remove /var/lib/apt/lists/*
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 1 Mar 2019 13:45:48 +0000 (14:45 +0100)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Fri, 1 Mar 2019 20:31:14 +0000 (20:31 +0000)
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 <gabrioux@redhat.com>
infrastructure-playbooks/purge-cluster.yml

index 588d6b2ff6539f0b54e5ddf9be7f36728fd6f07c..aa7a6e365c22b1ea8f88c5a1f92cbcfde9a6d314 100644 (file)
       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