Skip to content

Commit

Permalink
Merge branch 'devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
djdanielsson authored Aug 22, 2024
2 parents 18cc990 + 244bed7 commit df2001d
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 7 deletions.
36 changes: 36 additions & 0 deletions roles/job_templates/tasks/async.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Async block
block:
- name: "Managing Controller Job Templates | Wait for finish the Job Templates management"
ansible.builtin.async_status:
jid: "{{ __job_templates_job_async_result_item.ansible_job_id }}"
register: __job_templates_job_async_result
until: __job_templates_job_async_result.finished
retries: "{{ controller_configuration_job_templates_async_retries }}"
delay: "{{ controller_configuration_job_templates_async_delay }}"

rescue:
- name: Removing variables existance from result_file
ansible.builtin.replace:
path: "{{ __job_templates_job_async_result.results_file }}"
regexp: '\{\{.*?\}\}'
replace: ''

- name: "Load error details"
ansible.builtin.include_vars:
file: "{{ __job_templates_job_async_result.results_file }}"
name: __error_data

- name: "Building list of not processed templates"
ansible.builtin.set_fact:
__templates_error_list: "{{ __templates_error_list | default([]) + [ {

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}

Check warning on line 26 in roles/job_templates/tasks/async.yml

View workflow job for this annotation

GitHub Actions / pre-commit / changelog

jinja[spacing]

Jinja2 spacing could be improved: {{ __templates_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'] } ] }} -> {{ __templates_error_list | default([]) + [{'name': __error_data['invocation']['module_args']['name'], 'project_name': __error_data['invocation']['module_args']['project'], 'playbook': __error_data['invocation']['module_args']['playbook'], 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg']}] }}
'name': __error_data['invocation']['module_args']['name'],
'project_name': __error_data['invocation']['module_args']['project'],
'playbook': __error_data['invocation']['module_args']['playbook'],
'inventory': __error_data['invocation']['module_args']['inventory'],
'credentials': __error_data['invocation']['module_args']['credentials'],
'error': __error_data['msg']
}
]
}}"
...
16 changes: 9 additions & 7 deletions roles/job_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,8 @@
error_flag: true
when: ansible_check_mode and __job_templates_job_async.failed is defined and __job_templates_job_async.failed

- name: "Managing Controller Job Templates | Wait for finish the Job Templates management"
ansible.builtin.async_status:
jid: "{{ __job_templates_job_async_result_item.ansible_job_id }}"
register: __job_templates_job_async_result
until: __job_templates_job_async_result.finished
retries: "{{ controller_configuration_job_templates_async_retries }}"
delay: "{{ controller_configuration_job_templates_async_delay }}"
- name: "Managing Controller Job Templates | include async file"
ansible.builtin.include_tasks: "{{ role_path }}/tasks/async.yml"
loop: "{{ __job_templates_job_async.results }}"
loop_control:
loop_var: __job_templates_job_async_result_item
Expand All @@ -100,4 +95,11 @@
vars:
__operation: "{{ operation_translate[__job_templates_job_asycn_result_item.__controller_template_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'

- name: Set Job Templates error artifact
when: __templates_error_list is defined
ansible.builtin.set_stats:
data:
job_templates_errors: "{{ __templates_error_list }}"
register: __job_templates_errors_set_stats
...
23 changes: 23 additions & 0 deletions tests/configs/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ controller_templates:
choices: ''
new_question: true

controller_templates_invalid:
- name: test-template-1_with_missing_project
description: created by Ansible Playbook
job_type: run
inventory: RHVM-01
labels:
- Prod
credentials: admin@internal-RHVM-01
project: NonExistingProject
playbook: helloworld.yml
verbosity: 2
extra_vars:
target_hosts: infra-ansible-tower-01.example.com
- name: Demo Job Template with missing credentials
project: Test Project
job_type: run
playbook: helloworld.yml
ask_extra_vars: false
concurrent_jobs_enabled: false
credentials: Non exisiting Credential
verbosity: 0
inventory: localhost

# You can retrieve a job along with its survey spec using tower cli as follows:
# tower-cli receive --job_template <Name> --user admin --format yaml
# If you need to add Survey, Survey spec would look like given below:
Expand Down
18 changes: 18 additions & 0 deletions tests/configure_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@

tasks:

- name: Validate error handling
block:
- name: Add Invalid Job Templates to Controller
ansible.builtin.include_role:
name: job_templates
vars:
controller_templates: "{{ controller_templates_invalid }}"

- name: Ensure the job_templates_errors is defined and has items
ansible.builtin.assert:
that:
- job_templates_errors is defined
- job_templates_errors | length > 0
fail_msg: "No errors found, validate test example"
success_msg: "Errors found, proceeding"
vars:
job_templates_errors: __job_templates_errors_set_stats.ansible_stats.data.job_templates_errors

- name: Add Controller Settings Individually
ansible.builtin.include_role:
name: settings
Expand Down

0 comments on commit df2001d

Please sign in to comment.