forked from infra/ansible
communishift: wip shutting down projects marked for deletion
Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
parent
263a84d3b5
commit
c7b256b857
1 changed files with 27 additions and 1 deletions
|
|
@ -5,5 +5,31 @@
|
|||
|
||||
- name: Debug
|
||||
debug:
|
||||
msg: "Project {{ item.value.name }} marked for deletion"
|
||||
msg: "Project {{ item.value.name }} marked for shutdown"
|
||||
when: "not should_not_delete"
|
||||
|
||||
|
||||
|
||||
#- name: Loop over each project and scale its deployments to 0
|
||||
# block:
|
||||
# - name: Get list of deployments in the current project
|
||||
# kubernetes.core.k8s_info:
|
||||
# kind: Deployment
|
||||
# api_version: apps/v1
|
||||
# namespace: "{{ item }}"
|
||||
# register: deployment_list
|
||||
# loop: "{{ projects_list }}"
|
||||
#
|
||||
# - name: Scale each deployment to 0 replicas
|
||||
# kubernetes.core.k8s_scale:
|
||||
# api_version: apps/v1
|
||||
# kind: Deployment
|
||||
# name: "{{ dep.metadata.name }}"
|
||||
# namespace: "{{ item.item }}" # item.item is the project from the outer loop
|
||||
# replicas: 0
|
||||
# wait: true # Optional: wait for scale to complete
|
||||
# loop: "{{ deployment_list.results | selectattr('resources', 'defined') | map(attribute='resources') | flatten }}"
|
||||
# loop_control:
|
||||
# loop_var: dep
|
||||
# when: deployment_list.results is defined and deployment_list.results | length > 0
|
||||
# when: projects_list is defined and projects_list | length > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue