diff options
author | Gaƫtan <36162164+gaetanfl@users.noreply.github.com> | 2021-11-04 18:22:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-04 18:22:09 +0100 |
commit | a9a36e35be18c8c3ef078a13120974b316d2a8d4 (patch) | |
tree | 4043809a78561d860a981ee4b24f62a4621baf52 /tasks | |
parent | a8c403b74ad2d22c653183433c6ea3042868010f (diff) | |
parent | e43aa9af82046d06c4c9b93eaa23dfba44f62781 (diff) | |
download | ansible-rundeck-jobs-a9a36e35be18c8c3ef078a13120974b316d2a8d4.tar.gz ansible-rundeck-jobs-a9a36e35be18c8c3ef078a13120974b316d2a8d4.tar.zst ansible-rundeck-jobs-a9a36e35be18c8c3ef078a13120974b316d2a8d4.zip |
Merge pull request #8 from gaetanfl/fix_jobs_removalv0.7
bug: remove jobs from root when no group specified
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/rundeck.yml | 7 |
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" |