diff --git a/ansible_tools/playbooks/cleanup-venvs.yml b/ansible_tools/playbooks/cleanup-venvs.yml index 2c4d817c..3d904d9e 100644 --- a/ansible_tools/playbooks/cleanup-venvs.yml +++ b/ansible_tools/playbooks/cleanup-venvs.yml @@ -13,17 +13,34 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- - name: Remove older venvs hosts: all tasks: - - name: List older venvs directories - shell: "ls -1 /openstack/venvs | grep -v '{{ venv_tag }}$'" - register: files - when: venv_tag is defined - failed_when: files.rc == 2 - - name: Delete directories + - name: List venvs directories + find: + paths: /openstack/venvs + file_type: directory + patterns: '.*(?