diff options
author | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2021-11-15 15:34:49 +0100 |
---|---|---|
committer | Gaëtan Duchaussois <gaetan.duchaussois@fretlink.com> | 2021-11-15 15:34:49 +0100 |
commit | 95a202dcbd62d616698aedc7f993f91910b2187d (patch) | |
tree | b7218451255dd98ef7ac1bea70358a19404741a2 /tasks | |
parent | 0f0259c91faa37ec6c7e7d89cc47f41ca065a244 (diff) | |
download | ansible-rundeck-jobs-95a202dcbd62d616698aedc7f993f91910b2187d.tar.gz ansible-rundeck-jobs-95a202dcbd62d616698aedc7f993f91910b2187d.tar.zst ansible-rundeck-jobs-95a202dcbd62d616698aedc7f993f91910b2187d.zip |
Unmask Job creation error
The rundeck job creation api endpoint always return 200 with the result
in the body. The ansible action always succeed. This PR displays the
errors and if `rundeck_ignore_creation_error` is set to false, fails.
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/rundeck.yml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tasks/rundeck.yml b/tasks/rundeck.yml index 007b86e..1250d24 100644 --- a/tasks/rundeck.yml +++ b/tasks/rundeck.yml | |||
@@ -19,6 +19,18 @@ | |||
19 | register: rundeck_create_jobs | 19 | register: rundeck_create_jobs |
20 | with_items: "{{ rundeck_jobs_files.files}}" | 20 | with_items: "{{ rundeck_jobs_files.files}}" |
21 | 21 | ||
22 | - name: Check if a job failed | ||
23 | fail: | ||
24 | msg: "Job defined in {{ file }} has failed with message: {{ message }}" | ||
25 | with_items: "{{ rundeck_create_jobs.results }}" | ||
26 | loop_control: | ||
27 | label: "{{ item.item.path }}" | ||
28 | vars: | ||
29 | file: "{{ item.item.path }}" | ||
30 | message: "{{ item.json.failed }}" | ||
31 | when: item.json.failed|length > 0 | ||
32 | ignore_errors: "{{ rundeck_ignore_creation_error }}" | ||
33 | |||
22 | - name: Get all jobs | 34 | - name: Get all jobs |
23 | uri: | 35 | uri: |
24 | url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_jobs_group | default(rundeck_empty_group_path) }}" | 36 | url: "{{rundeck_api_url }}/{{rundeck_api_version}}/project/{{ rundeck_project }}/jobs?groupPathExact={{ rundeck_jobs_group | default(rundeck_empty_group_path) }}" |