aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/rundeck.yml
diff options
context:
space:
mode:
authorGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>2021-11-04 17:35:50 +0100
committerGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>2021-11-04 17:35:50 +0100
commite43aa9af82046d06c4c9b93eaa23dfba44f62781 (patch)
tree4043809a78561d860a981ee4b24f62a4621baf52 /tasks/rundeck.yml
parenta8c403b74ad2d22c653183433c6ea3042868010f (diff)
downloadansible-rundeck-jobs-e43aa9af82046d06c4c9b93eaa23dfba44f62781.tar.gz
ansible-rundeck-jobs-e43aa9af82046d06c4c9b93eaa23dfba44f62781.tar.zst
ansible-rundeck-jobs-e43aa9af82046d06c4c9b93eaa23dfba44f62781.zip
bug: remove only jobs from root when no group specified
Diffstat (limited to 'tasks/rundeck.yml')
-rw-r--r--tasks/rundeck.yml7
1 files changed, 5 insertions, 2 deletions
diff --git a/tasks/rundeck.yml b/tasks/rundeck.yml
index 4396552..007b86e 100644
--- a/tasks/rundeck.yml
+++ b/tasks/rundeck.yml
@@ -27,14 +27,17 @@
27 Accept: application/json 27 Accept: application/json
28 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}" 28 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}"
29 vars: 29 vars:
30 rundeck_empty_group_path: '""' 30 rundeck_empty_group_path: ''
31 register: rundeck_existing_jobs 31 register: rundeck_existing_jobs
32 when: rundeck_remove_missing 32 when: rundeck_remove_missing
33 33
34- name: "Prepare list of jobs to remove" 34- name: "Prepare list of jobs to remove"
35 set_fact: 35 set_fact:
36 rundeck_created_ids: "{{ rundeck_create_jobs.results | map(attribute='json') | map('json_query','succeeded[*].id') | flatten | list }}" 36 rundeck_created_ids: "{{ rundeck_create_jobs.results | map(attribute='json') | map('json_query','succeeded[*].id') | flatten | list }}"
37 rundeck_jobs_ids: "{{ rundeck_existing_jobs.json | map(attribute='id') | list }}" 37 rundeck_jobs_ids: "{{ rundeck_existing_jobs_list | map(attribute='id') | list }}"
38 vars:
39 rundeck_existing_jobs_list_null: "{{ rundeck_existing_jobs.json | selectattr('group', 'none') | list }}"
40 rundeck_existing_jobs_list: "{{ rundeck_jobs_group | default(false) | ternary(rundeck_existing_jobs.json, rundeck_existing_jobs_list_null) }}"
38 when: rundeck_remove_missing 41 when: rundeck_remove_missing
39 42
40- name: "Remove jobs not in the directory" 43- name: "Remove jobs not in the directory"