kubespray/tests/cloud_playbooks/roles/packet-ci/tasks/cleanup-old-vms.yml

18 lines
435 B
YAML

---
- name: Fetch a list of namespaces
kubernetes.core.k8s_info:
api_version: v1
kind: Namespace
label_selectors:
- cijobs = true
- branch = {{ branch }}
register: namespaces
- name: Delete older namespaces
command: "kubectl delete namespace {{ item.metadata.name }}"
failed_when: false
loop: "{{ namespaces.resources }}"
when:
- (item.metadata.labels.pipeline_id | int) < (pipeline_id | int)