From 0065a6ebecaa496a3fba0320ee2df64d528a5c98 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:23:36 +0100 Subject: [PATCH 01/34] feat: error handling for job templates --- .../defaults/main.yml | 1 + .../controller_job_templates/tasks/async.yml | 27 ------------ .../tasks/async_template.yml | 43 +++++++++++++++++++ roles/controller_job_templates/tasks/main.yml | 9 +--- 4 files changed, 46 insertions(+), 34 deletions(-) delete mode 100644 roles/controller_job_templates/tasks/async.yml create mode 100644 roles/controller_job_templates/tasks/async_template.yml diff --git a/roles/controller_job_templates/defaults/main.yml b/roles/controller_job_templates/defaults/main.yml index 25740f619..ccb440ec5 100644 --- a/roles/controller_job_templates/defaults/main.yml +++ b/roles/controller_job_templates/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_job_templates_async_delay: "{{ aap_configuration_async_ controller_configuration_job_templates_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_job_templates_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_job_templates/tasks/async.yml b/roles/controller_job_templates/tasks/async.yml deleted file mode 100644 index bc08a9028..000000000 --- a/roles/controller_job_templates/tasks/async.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: async | Async block - block: - - name: async | 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: async | Removing variables existence from result_file - ansible.builtin.replace: - path: "{{ __job_templates_job_async_result.results_file }}" - regexp: \{\{.*?\}\} - replace: "" - - - name: async | Load error details - ansible.builtin.include_vars: - file: "{{ __job_templates_job_async_result.results_file }}" - name: __error_data - - - name: async | Building list of not processed templates - ansible.builtin.set_fact: - __templates_error_list: "{{ __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'] } ] }}" -... diff --git a/roles/controller_job_templates/tasks/async_template.yml b/roles/controller_job_templates/tasks/async_template.yml new file mode 100644 index 000000000..a04090a65 --- /dev/null +++ b/roles/controller_job_templates/tasks/async_template.yml @@ -0,0 +1,43 @@ +--- +- name: async_template | An async_template block + block: + - name: async_template | Managing Controller Job Templates | Wait for finish the Job Templates management + ansible.builtin.async_template_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_template_retries }}" + delay: "{{ controller_configuration_job_templates_async_template_delay }}" + + rescue: + - name: async_template | Removing variables existance from result_file + ansible.builtin.replace: + path: "{{ __job_templates_job_async_result.results_file }}" + regexp: \{\{.*?\}\} + replace: "" + + - name: async_template | Load error details + ansible.builtin.include_vars: + file: "{{ __job_templates_job_async_result.results_file }}" + name: __error_data + + - name: async_template | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_template | Building list of not processed templates + ansible.builtin.set_fact: + __templates_error_list: "{{ __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'], + 'response': __error_data['response'] + } + ] + }}" +... diff --git a/roles/controller_job_templates/tasks/main.yml b/roles/controller_job_templates/tasks/main.yml index 61c41bae3..75f2e6874 100644 --- a/roles/controller_job_templates/tasks/main.yml +++ b/roles/controller_job_templates/tasks/main.yml @@ -84,16 +84,11 @@ when: ansible_check_mode and __job_templates_job_async.failed is defined and __job_templates_job_async.failed - name: Managing 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 }}" + ansible.builtin.include_tasks: async_template.yml loop: "{{ __job_templates_job_async.results }}" loop_control: loop_var: __job_templates_job_async_result_item - label: "{{ __operation.verb }} Job Template {{ __job_templates_job_async_result_item.__controller_template_item.name }} | Wait for finish the Job Template {{ __operation.action }}" + label: "{{ __operation.verb }} Job Template {{ __job_templates_job_async_result_item }} | Wait for finish the Job Template {{ __operation.action }}" when: not ansible_check_mode and __job_templates_job_async_result_item.ansible_job_id is defined no_log: "{{ controller_configuration_job_templates_secure_logging }}" vars: From 936bc4311c624cc9c1a810df3e44b4cafa130f42 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:24:34 +0100 Subject: [PATCH 02/34] feat: error handling for projects --- roles/controller_projects/defaults/main.yml | 1 + .../tasks/async_project.yml | 31 +++++++++++++++++++ roles/controller_projects/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_projects/tasks/async_project.yml diff --git a/roles/controller_projects/defaults/main.yml b/roles/controller_projects/defaults/main.yml index 17a4aa757..d87daeb6e 100644 --- a/roles/controller_projects/defaults/main.yml +++ b/roles/controller_projects/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_projects_async_delay: "{{ aap_configuration_async_delay controller_configuration_projects_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_projects_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_projects/tasks/async_project.yml b/roles/controller_projects/tasks/async_project.yml new file mode 100644 index 000000000..46e8ea0f2 --- /dev/null +++ b/roles/controller_projects/tasks/async_project.yml @@ -0,0 +1,31 @@ +--- +- name: async_project | An async_project block + block: + - name: async_project | Managing Controller projects | Wait for finish the Projects management + ansible.builtin.async_status: + jid: "{{ __projects_job_async_results_item.ansible_job_id }}" + register: __projects_job_async_result + until: __projects_job_async_result.finished + retries: "{{ controller_configuration_projects_async_retries }}" + delay: "{{ controller_configuration_projects_async_delay }}" + rescue: + - name: async_project | Load error details + ansible.builtin.include_vars: + file: "{{ __projects_job_async_result.results_file }}" + name: __error_data + + - name: async_project | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_project | Building list of not processed projects + ansible.builtin.set_fact: + __projects_error_list: "{{ __projects_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_projects/tasks/main.yml b/roles/controller_projects/tasks/main.yml index d056f00ea..2f7f54abe 100644 --- a/roles/controller_projects/tasks/main.yml +++ b/roles/controller_projects/tasks/main.yml @@ -57,12 +57,7 @@ when: ansible_check_mode and __projects_job_async.failed is defined and __projects_job_async.failed - name: Managing Projects | Wait for finish the projects management - ansible.builtin.async_status: - jid: "{{ __projects_job_async_results_item.ansible_job_id }}" - register: __projects_job_async_result - until: __projects_job_async_result.finished - retries: "{{ controller_configuration_projects_async_retries }}" - delay: "{{ controller_configuration_projects_async_delay }}" + ansible.builtin.include_tasks: async_project.yml loop: "{{ __projects_job_async.results }}" loop_control: loop_var: __projects_job_async_results_item From c29cea09d3866cd9796ab1927e750f8b05471eba Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:24:58 +0100 Subject: [PATCH 03/34] feat: error handling for workflows --- .../defaults/main.yml | 1 + .../tasks/add_workflows_schema.yml | 13 ++------ .../tasks/async_workflow.yml | 32 ++++++++++++++++++ .../tasks/async_workflow_node.yml | 32 ++++++++++++++++++ .../tasks/async_workflow_node_link.yml | 33 +++++++++++++++++++ .../tasks/main.yml | 7 +--- 6 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 roles/controller_workflow_job_templates/tasks/async_workflow.yml create mode 100644 roles/controller_workflow_job_templates/tasks/async_workflow_node.yml create mode 100644 roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml diff --git a/roles/controller_workflow_job_templates/defaults/main.yml b/roles/controller_workflow_job_templates/defaults/main.yml index a9f496967..09b2bbf12 100644 --- a/roles/controller_workflow_job_templates/defaults/main.yml +++ b/roles/controller_workflow_job_templates/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_workflow_async_delay: "{{ aap_configuration_async_delay controller_configuration_workflow_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_workflows_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_workflow_job_templates/tasks/add_workflows_schema.yml b/roles/controller_workflow_job_templates/tasks/add_workflows_schema.yml index 1fcb309b9..0b492cda7 100644 --- a/roles/controller_workflow_job_templates/tasks/add_workflows_schema.yml +++ b/roles/controller_workflow_job_templates/tasks/add_workflows_schema.yml @@ -54,11 +54,7 @@ when: ansible_check_mode and __workflows_node_async.failed is defined and __workflows_node_async.failed - name: add_workflows_schema | Manage Workflows | Wait for finish the workflow creation - ansible.builtin.async_status: - jid: "{{ __workflows_node_async_results_item.ansible_job_id }}" - register: __workflows_node_async_result - until: __workflows_node_async_result.finished - retries: 10 + ansible.builtin.include_tasks: async_workflow_node.yml loop: "{{ __workflows_node_async.results }}" loop_control: loop_var: __workflows_node_async_results_item @@ -107,12 +103,7 @@ when: ansible_check_mode and __workflows_link_async.failed is defined and __workflows_link_async.failed - name: add_workflows_schema | Manage Workflows | Wait for finish the workflow creation - ansible.builtin.async_status: - jid: "{{ __workflows_link_async_results_item.ansible_job_id }}" - register: __workflows_link_async_result - until: __workflows_link_async_result.finished - retries: "{{ controller_configuration_workflow_async_retries }}" - delay: "{{ controller_configuration_workflow_async_delay }}" + ansible.builtin.include_tasks: async_workflow_node_link.yml loop: "{{ __workflows_link_async.results }}" loop_control: loop_var: __workflows_link_async_results_item diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow.yml b/roles/controller_workflow_job_templates/tasks/async_workflow.yml new file mode 100644 index 000000000..30a3ee472 --- /dev/null +++ b/roles/controller_workflow_job_templates/tasks/async_workflow.yml @@ -0,0 +1,32 @@ +--- +- name: async_workflow | An async_workflow block + block: + - name: async_workflow | Managing Controller Workflow Job Templates | Wait for finish the Workflow Job Templates management + ansible.builtin.async_status: + jid: "{{ __workflows_job_async_results_item.ansible_job_id }}" + register: __workflows_job_async_result + until: __workflows_job_async_result.finished + retries: "{{ controller_configuration_workflow_async_retries }}" + delay: "{{ controller_configuration_workflow_async_delay }}" + + rescue: + - name: async_workflow | Load error details + ansible.builtin.include_vars: + file: "{{ __workflows_job_async_result.results_file }}" + name: __error_data + + - name: async_workflow | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_workflow | Building list of not processed workflows + ansible.builtin.set_fact: + __workflows_error_list: "{{ __workflows_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), + 'error': __error_data['msg'] | default(__workflows_job_async_result['msg']) + } + ] + }}" +... diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml new file mode 100644 index 000000000..39e13e8c3 --- /dev/null +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml @@ -0,0 +1,32 @@ +--- +- name: async_workflow_node | An async_workflow_node block + block: + - name: async_workflow_node | Manage Workflows nodes | Wait for finish the workflow node creation + ansible.builtin.async_status: + jid: "{{ __workflows_node_async_results_item.ansible_job_id }}" + register: __workflows_node_async_result + until: __workflows_node_async_result.finished + retries: 10 + + rescue: + - name: async_workflow_node | Load error details + ansible.builtin.include_vars: + file: "{{ __workflows_node_async_result.results_file }}" + name: __error_data + + - name: async_workflow_node | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_workflow_node | Building list of not processed nodes + ansible.builtin.set_fact: + __workflow_nodes_error_list: "{{ __workflow_nodes_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), + 'type': 'node creation', + 'error': __error_data['msg'] | default(__workflows_node_async_result['msg']) + } + ] + }}" +... diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml new file mode 100644 index 000000000..c329b15fd --- /dev/null +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml @@ -0,0 +1,33 @@ +--- +- name: async_workflow_node_link | An async_workflow_node_link block + block: + - name: async_workflow_node_link | Manage Workflows | Wait for finish the workflow creation + ansible.builtin.async_status: + jid: "{{ __workflows_link_async_results_item.ansible_job_id }}" + register: __workflows_link_async_result + until: __workflows_link_async_result.finished + retries: "{{ controller_configuration_workflow_async_retries }}" + delay: "{{ controller_configuration_workflow_async_delay }}" + + rescue: + - name: async_workflow_node_link | Load error details + ansible.builtin.include_vars: + file: "{{ __workflows_link_async_result.results_file }}" + name: __error_data + + - name: async_workflow_node_link | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_workflow_node_link | Building list of not processed links + ansible.builtin.set_fact: + __workflow_nodes_error_list: "{{ workflow_nodes_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), + 'type': 'link issue', + 'error': __error_data['msg'] | default(__workflows_link_async_result['msg']) + } + ] + }}" +... diff --git a/roles/controller_workflow_job_templates/tasks/main.yml b/roles/controller_workflow_job_templates/tasks/main.yml index 1c90997d4..6715fecee 100644 --- a/roles/controller_workflow_job_templates/tasks/main.yml +++ b/roles/controller_workflow_job_templates/tasks/main.yml @@ -59,12 +59,7 @@ when: ansible_check_mode and __workflows_job_async.failed is defined and __workflows_job_async.failed - name: Managing Workflows | Wait for finish the workflow management - ansible.builtin.async_status: - jid: "{{ __workflows_job_async_results_item.ansible_job_id }}" - register: __workflows_job_async_result - until: __workflows_job_async_result.finished - retries: "{{ controller_configuration_workflow_async_retries }}" - delay: "{{ controller_configuration_workflow_async_delay }}" + ansible.builtin.include_tasks: async_workflow.yml loop: "{{ __workflows_job_async.results }}" loop_control: loop_var: __workflows_job_async_results_item From 34038309889614ab7aca4d213c28c43d6c01a6b7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:30:41 +0100 Subject: [PATCH 04/34] feat: error handling for applications --- .../controller_applications/defaults/main.yml | 1 + .../tasks/async_application.yml | 31 +++++++++++++++++++ roles/controller_applications/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_applications/tasks/async_application.yml diff --git a/roles/controller_applications/defaults/main.yml b/roles/controller_applications/defaults/main.yml index 6d3398ab3..bc99b1b8a 100644 --- a/roles/controller_applications/defaults/main.yml +++ b/roles/controller_applications/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_applications_async_delay: "{{ aap_configuration_async_d controller_configuration_applications_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_applications_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_applications/tasks/async_application.yml b/roles/controller_applications/tasks/async_application.yml new file mode 100644 index 000000000..1ceea74d4 --- /dev/null +++ b/roles/controller_applications/tasks/async_application.yml @@ -0,0 +1,31 @@ +--- +- name: async_application | An async_application block + block: + - name: async_application | Managing Controller applications | Wait for finish the applications management + ansible.builtin.async_status: + jid: "{{ __applications_job_async_result_item.ansible_job_id }}" + register: __applications_job_async_result + until: __applications_job_async_result.finished + retries: "{{ controller_configuration_applications_async_retries }}" + delay: "{{ controller_configuration_applications_async_delay }}" + rescue: + - name: async_application | Load error details + ansible.builtin.include_vars: + file: "{{ __applications_job_async_result.results_file }}" + name: __error_data + + - name: async_application | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_application | Building list of not processed applications + ansible.builtin.set_fact: + __applications_error_list: "{{ __applications_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_applications/tasks/main.yml b/roles/controller_applications/tasks/main.yml index 822d1fb70..6fe73ffbc 100644 --- a/roles/controller_applications/tasks/main.yml +++ b/roles/controller_applications/tasks/main.yml @@ -39,12 +39,7 @@ when: ansible_check_mode and __applications_job_async.failed is defined and __applications_job_async.failed - name: Managing Controller Applications | Wait for finish the Application management - ansible.builtin.async_status: - jid: "{{ __applications_job_async_results_item.ansible_job_id }}" - register: __applications_job_async_result - until: __applications_job_async_result.finished - retries: "{{ controller_configuration_applications_async_retries }}" - delay: "{{ controller_configuration_applications_async_delay }}" + ansible.builtin.include_tasks: async_application.yml loop: "{{ __applications_job_async.results }}" loop_control: loop_var: __applications_job_async_results_item From 29f619a3a26ff3ca2b889b4233d8f2f80a8a2210 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:40:48 +0100 Subject: [PATCH 05/34] feat: error handling for bulk host create --- .../defaults/main.yml | 1 + .../tasks/async_bulk_host.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_bulk_host_create/tasks/async_bulk_host.yml diff --git a/roles/controller_bulk_host_create/defaults/main.yml b/roles/controller_bulk_host_create/defaults/main.yml index ca163e189..a3a3d5e6e 100644 --- a/roles/controller_bulk_host_create/defaults/main.yml +++ b/roles/controller_bulk_host_create/defaults/main.yml @@ -4,4 +4,5 @@ controller_configuration_bulk_hosts_async_retries: "{{ aap_configuration_async_r controller_configuration_bulk_hosts_async_delay: "{{ aap_configuration_async_delay | default(1) }}" controller_configuration_bulk_hosts_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: +collect_logs: false ... diff --git a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml new file mode 100644 index 000000000..7941bdc28 --- /dev/null +++ b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml @@ -0,0 +1,31 @@ +--- +- name: async_bulk_host | An async_bulk_host block + block: + - name: async_bulk_host | Managing Controller bulk_hosts | Wait for finish the bulk_hosts management + ansible.builtin.async_status: + jid: "{{ __controller_bulk_hosts_job_async_results_item.ansible_job_id }}" + register: __controller_bulk_hosts_job_async_result + until: __controller_bulk_hosts_job_async_result.finished + retries: "{{ controller_configuration_bulk_hosts_async_retries }}" + delay: "{{ controller_configuration_bulk_hosts_async_delay }}" + rescue: + - name: async_bulk_host | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_bulk_hosts_job_async_result.results_file }}" + name: __error_data + + - name: async_bulk_host | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_bulk_host | Building list of not processed bulk_hosts + ansible.builtin.set_fact: + __bulk_hosts_error_list: "{{ __bulk_hosts_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_bulk_host_create/tasks/main.yml b/roles/controller_bulk_host_create/tasks/main.yml index d3c6dc24d..66d17720c 100644 --- a/roles/controller_bulk_host_create/tasks/main.yml +++ b/roles/controller_bulk_host_create/tasks/main.yml @@ -30,12 +30,7 @@ when: ansible_check_mode and __controller_bulk_hosts_job_async.failed is defined and __controller_bulk_hosts_job_async.failed - name: Configure bulk_hosts | Wait for finish the bulk_hosts creation - ansible.builtin.async_status: - jid: "{{ __controller_bulk_hosts_job_async_results_item.ansible_job_id }}" - register: __controller_bulk_hosts_job_async_result - until: __controller_bulk_hosts_job_async_result.finished - retries: "{{ controller_configuration_bulk_hosts_async_retries }}" - delay: "{{ controller_configuration_bulk_hosts_async_delay }}" + ansible.builtin.include_tasks: async_bulk_host.yml loop: "{{ __controller_bulk_hosts_job_async.results }}" loop_control: loop_var: __controller_bulk_hosts_job_async_results_item From bad6f1b8532452aed710f29749c4ac760b4e7ce0 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:44:47 +0100 Subject: [PATCH 06/34] feat: error handling for credential_input_sources --- .../defaults/main.yml | 1 + .../tasks/async_credential_input.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_credential_input_sources/tasks/async_credential_input.yml diff --git a/roles/controller_credential_input_sources/defaults/main.yml b/roles/controller_credential_input_sources/defaults/main.yml index 0fed12746..031aaca4b 100644 --- a/roles/controller_credential_input_sources/defaults/main.yml +++ b/roles/controller_credential_input_sources/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_credential_input_sources_async_delay: "{{ aap_configura controller_configuration_credential_input_sources_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_credential_input_sources_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_credential_input_sources/tasks/async_credential_input.yml b/roles/controller_credential_input_sources/tasks/async_credential_input.yml new file mode 100644 index 000000000..18d0961d2 --- /dev/null +++ b/roles/controller_credential_input_sources/tasks/async_credential_input.yml @@ -0,0 +1,31 @@ +--- +- name: async_credential_input | An async_credential_input block + block: + - name: async_credential_input | Managing Controller bulk_hosts | Wait for finish the bulk_hosts management + ansible.builtin.async_status: + jid: "{{ __credential_input_sources_job_async_results_item.ansible_job_id }}" + register: __credential_input_sources_job_async_result + until: __credential_input_sources_job_async_result.finished + retries: "{{ controller_configuration_credential_input_sources_async_retries }}" + delay: "{{ controller_configuration_credential_input_sources_async_delay }}" + rescue: + - name: async_credential_input | Load error details + ansible.builtin.include_vars: + file: "{{ __credential_input_sources_job_async_result.results_file }}" + name: __error_data + + - name: async_credential_input | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_credential_input | Building list of not processed bulk_hosts + ansible.builtin.set_fact: + __credential_inputs_error_list: "{{ __bulk_hosts_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_credential_input_sources/tasks/main.yml b/roles/controller_credential_input_sources/tasks/main.yml index cebb2cff8..7090d5257 100644 --- a/roles/controller_credential_input_sources/tasks/main.yml +++ b/roles/controller_credential_input_sources/tasks/main.yml @@ -35,12 +35,7 @@ when: ansible_check_mode and __credential_input_sources_job_async.failed is defined and __credential_input_sources_job_async.failed - name: Managing Controller Credential Input Sources | Wait for finish the Controller Credential Input Sources management - ansible.builtin.async_status: - jid: "{{ __credential_input_sources_job_async_results_item.ansible_job_id }}" - register: __credential_input_sources_job_async_result - until: __credential_input_sources_job_async_result.finished - retries: "{{ controller_configuration_credential_input_sources_async_retries }}" - delay: "{{ controller_configuration_credential_input_sources_async_delay }}" + ansible.builtin.include_tasks: async_credential_input.yml loop: "{{ __credential_input_sources_job_async.results }}" loop_control: loop_var: __credential_input_sources_job_async_results_item From 00e8fec56ed2d116ad44428f2c686c17ab687564 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:45:56 +0100 Subject: [PATCH 07/34] feat: error handling for credential_type --- .../defaults/main.yml | 1 + .../tasks/async_credetnial_type.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_credential_types/tasks/async_credetnial_type.yml diff --git a/roles/controller_credential_types/defaults/main.yml b/roles/controller_credential_types/defaults/main.yml index c65caf891..0ab6bc736 100644 --- a/roles/controller_credential_types/defaults/main.yml +++ b/roles/controller_credential_types/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_credential_types_async_delay: "{{ aap_configuration_asy controller_configuration_credential_types_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_credential_types_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_credential_types/tasks/async_credetnial_type.yml b/roles/controller_credential_types/tasks/async_credetnial_type.yml new file mode 100644 index 000000000..fc14a2047 --- /dev/null +++ b/roles/controller_credential_types/tasks/async_credetnial_type.yml @@ -0,0 +1,31 @@ +--- +- name: async_credential_type | An async_credential_type block + block: + - name: async_credential_type | Managing Controller credential_types | Wait for finish the credential_types management + ansible.builtin.async_status: + jid: "{{ __credentialtypes_job_async_result_item.ansible_job_id }}" + register: __credentialtypes_job_async_result + until: __credentialtypes_job_async_result.finished + retries: "{{ controller_configuration_credential_types_async_retries }}" + delay: "{{ controller_configuration_credential_types_async_delay }}" + rescue: + - name: async_credential_type | Load error details + ansible.builtin.include_vars: + file: "{{ __credentialtypes_job_async_result.results_file }}" + name: __error_data + + - name: async_credential_type | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_credential_type | Building list of not processed credential_types + ansible.builtin.set_fact: + __credentialtypes_error_list: "{{ __credentialtypes_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_credential_types/tasks/main.yml b/roles/controller_credential_types/tasks/main.yml index e668e285d..478b3cc62 100644 --- a/roles/controller_credential_types/tasks/main.yml +++ b/roles/controller_credential_types/tasks/main.yml @@ -36,12 +36,7 @@ when: ansible_check_mode and __credentialtypes_job_async.failed is defined and __credentialtypes_job_async.failed - name: Managing Controller Credential Types | Wait for finish the credential types management - ansible.builtin.async_status: - jid: "{{ __credentialtypes_job_async_result_item.ansible_job_id }}" - register: __credentialtypes_job_async_result - until: __credentialtypes_job_async_result.finished - retries: "{{ controller_configuration_credential_types_async_retries }}" - delay: "{{ controller_configuration_credential_types_async_delay }}" + ansible.builtin.include_tasks: async_credential_type.yml loop: "{{ __credentialtypes_job_async.results }}" loop_control: loop_var: __credentialtypes_job_async_result_item From ce1a147ca9d50a9cc7a2c5d64c3e6a4a593fd545 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:47:49 +0100 Subject: [PATCH 08/34] feat: error handling for credentials --- .../controller_credentials/defaults/main.yml | 1 + .../tasks/async_credential.yaml | 31 +++++++++++++++++++ roles/controller_credentials/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_credentials/tasks/async_credential.yaml diff --git a/roles/controller_credentials/defaults/main.yml b/roles/controller_credentials/defaults/main.yml index 52219c86f..4c3ddc7ee 100644 --- a/roles/controller_credentials/defaults/main.yml +++ b/roles/controller_credentials/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_credentials_async_delay: "{{ aap_configuration_async_de controller_configuration_credentials_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_credentials_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_credentials/tasks/async_credential.yaml b/roles/controller_credentials/tasks/async_credential.yaml new file mode 100644 index 000000000..43e50864b --- /dev/null +++ b/roles/controller_credentials/tasks/async_credential.yaml @@ -0,0 +1,31 @@ +--- +- name: async_credential | An async_credential block + block: + - name: async_credential | Managing Controller credentials | Wait for finish the credentials management + ansible.builtin.async_status: + jid: "{{ __credentials_job_async_result_item.ansible_job_id }}" + register: __credentials_job_async_result + until: __credentials_job_async_result.finished + retries: "{{ controller_configuration_credentials_async_retries }}" + delay: "{{ controller_configuration_credentials_async_delay }}" + rescue: + - name: async_credential | Load error details + ansible.builtin.include_vars: + file: "{{ __credentials_job_async_result.results_file }}" + name: __error_data + + - name: async_credential | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_credential | Building list of not processed credentials + ansible.builtin.set_fact: + __credentials_error_list: "{{ __credentials_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_credentials/tasks/main.yml b/roles/controller_credentials/tasks/main.yml index 67c298994..3f52d70fd 100644 --- a/roles/controller_credentials/tasks/main.yml +++ b/roles/controller_credentials/tasks/main.yml @@ -40,12 +40,7 @@ when: ansible_check_mode and __credentials_job_async.failed is defined and __credentials_job_async.failed - name: Managing Controller Credentials | Wait for finish the credential management - ansible.builtin.async_status: - jid: "{{ __credentials_job_async_results_item.ansible_job_id }}" - register: __credentials_job_async_result - until: __credentials_job_async_result.finished - retries: "{{ controller_configuration_credentials_async_retries }}" - delay: "{{ controller_configuration_credentials_async_delay }}" + ansible.builtin.include_tasks: async_credential.yml loop: "{{ __credentials_job_async.results }}" loop_control: loop_var: __credentials_job_async_results_item From 9f484e9071d0b040e78aacc3ca2299960646455b Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 11:57:44 +0100 Subject: [PATCH 09/34] feat: error handling for execution environment --- .../defaults/main.yml | 1 + .../tasks/async_execution_environment.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_execution_environments/tasks/async_execution_environment.yml diff --git a/roles/controller_execution_environments/defaults/main.yml b/roles/controller_execution_environments/defaults/main.yml index 4d601f74b..283087ba1 100644 --- a/roles/controller_execution_environments/defaults/main.yml +++ b/roles/controller_execution_environments/defaults/main.yml @@ -6,4 +6,5 @@ controller_configuration_execution_environments_async_delay: "{{ aap_configurati controller_configuration_execution_environments_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_execution_environments_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_execution_environments/tasks/async_execution_environment.yml b/roles/controller_execution_environments/tasks/async_execution_environment.yml new file mode 100644 index 000000000..e05b05919 --- /dev/null +++ b/roles/controller_execution_environments/tasks/async_execution_environment.yml @@ -0,0 +1,31 @@ +--- +- name: async_execution_environment | An async_execution_environment block + block: + - name: async_execution_environment | Managing Controller credential_types | Wait for finish the credential_types management + ansible.builtin.async_status: + jid: "{{ __execution_environments_job_async_result_item.ansible_job_id }}" + register: __execution_environments_job_async_result + until: __execution_environments_job_async_result.finished + retries: "{{ controller_configuration_execution_environments_async_retries }}" + delay: "{{ controller_configuration_execution_environments_async_delay }}" + rescue: + - name: async_execution_environment | Load error details + ansible.builtin.include_vars: + file: "{{ __execution_environments_job_async_result.results_file }}" + name: __error_data + + - name: async_execution_environment | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_execution_environment | Building list of not processed credential_types + ansible.builtin.set_fact: + __execution_environment_error_list: "{{ __credentialtypes_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_execution_environments/tasks/main.yml b/roles/controller_execution_environments/tasks/main.yml index 12d554ff3..a3b7e22ad 100644 --- a/roles/controller_execution_environments/tasks/main.yml +++ b/roles/controller_execution_environments/tasks/main.yml @@ -39,12 +39,7 @@ when: ansible_check_mode and __execution_environments_job_async.failed is defined and __execution_environments_job_async.failed - name: Managing Controller Execution Environments | Wait for finish the Controller Execution Environments management - ansible.builtin.async_status: - jid: "{{ __execution_environments_job_async_results_item.ansible_job_id }}" - register: __execution_environments_job_async_result - until: __execution_environments_job_async_result.finished - retries: "{{ controller_configuration_execution_environments_async_retries }}" - delay: "{{ controller_configuration_execution_environments_async_delay }}" + ansible.builtin.include_tasks: async_execution_environment.yml loop: "{{ __execution_environments_job_async.results }}" loop_control: loop_var: __execution_environments_job_async_results_item From 037d7154721b8ccce50afeb9cb7849c1c2a648d8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 12:08:41 +0100 Subject: [PATCH 10/34] fix: wrong variable --- .../tasks/async_credential_input.yml | 12 ++++++------ .../tasks/async_execution_environment.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/controller_credential_input_sources/tasks/async_credential_input.yml b/roles/controller_credential_input_sources/tasks/async_credential_input.yml index 18d0961d2..4de4819f6 100644 --- a/roles/controller_credential_input_sources/tasks/async_credential_input.yml +++ b/roles/controller_credential_input_sources/tasks/async_credential_input.yml @@ -21,11 +21,11 @@ - name: async_credential_input | Building list of not processed bulk_hosts ansible.builtin.set_fact: - __credential_inputs_error_list: "{{ __bulk_hosts_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] + __credential_inputs_error_list: "{{ __credential_inputs_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] }}" ... diff --git a/roles/controller_execution_environments/tasks/async_execution_environment.yml b/roles/controller_execution_environments/tasks/async_execution_environment.yml index e05b05919..8a7f0a166 100644 --- a/roles/controller_execution_environments/tasks/async_execution_environment.yml +++ b/roles/controller_execution_environments/tasks/async_execution_environment.yml @@ -21,7 +21,7 @@ - name: async_execution_environment | Building list of not processed credential_types ansible.builtin.set_fact: - __execution_environment_error_list: "{{ __credentialtypes_error_list | default([]) + [ + __execution_environment_error_list: "{{ __execution_environment_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'] | default(''), 'error': __error_data['msg'] | default('') From 45e5a280a70433ba8d3340e5b8cb4d676c3a14af Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 12:17:44 +0100 Subject: [PATCH 11/34] feat: error handling for host group --- .../controller_host_groups/defaults/main.yml | 1 + .../tasks/async_host_group.yml | 31 +++++++++++++++++++ roles/controller_host_groups/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_host_groups/tasks/async_host_group.yml diff --git a/roles/controller_host_groups/defaults/main.yml b/roles/controller_host_groups/defaults/main.yml index 51ea1538e..1e58d06b7 100644 --- a/roles/controller_host_groups/defaults/main.yml +++ b/roles/controller_host_groups/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_group_async_delay: "{{ aap_configuration_async_delay | controller_configuration_group_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_groups_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_host_groups/tasks/async_host_group.yml b/roles/controller_host_groups/tasks/async_host_group.yml new file mode 100644 index 000000000..4e87bf43a --- /dev/null +++ b/roles/controller_host_groups/tasks/async_host_group.yml @@ -0,0 +1,31 @@ +--- +- name: async_host_group | An async_host_group block + block: + - name: async_host_group | Managing Controller credential_types | Wait for finish the credential_types management + ansible.builtin.async_status: + jid: "{{ __group_job_async_results_item.ansible_job_id }}" + register: __group_job_async_result + until: __group_job_async_result.finished + retries: "{{ controller_configuration_group_async_retries }}" + delay: "{{ controller_configuration_group_async_delay }}" + rescue: + - name: async_host_group | Load error details + ansible.builtin.include_vars: + file: "{{ __group_job_async_result.results_file }}" + name: __error_data + + - name: async_host_group | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_host_group | Building list of not processed credential_types + ansible.builtin.set_fact: + __host_group_error_list: "{{ __host_group_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_host_groups/tasks/main.yml b/roles/controller_host_groups/tasks/main.yml index 1cb8ec940..8c3c390e9 100644 --- a/roles/controller_host_groups/tasks/main.yml +++ b/roles/controller_host_groups/tasks/main.yml @@ -41,12 +41,7 @@ when: ansible_check_mode and __group_job_async.failed is defined and __group_job_async.failed - name: Managing Controller Groups | Wait for finish the Controller Groups management - ansible.builtin.async_status: - jid: "{{ __group_job_async_results_item.ansible_job_id }}" - register: __group_job_async_result - until: __group_job_async_result.finished - retries: "{{ controller_configuration_group_async_retries }}" - delay: "{{ controller_configuration_group_async_delay }}" + ansible.builtin.include_tasks: async_host_group.yml loop: "{{ __group_job_async.results }}" loop_control: loop_var: __group_job_async_results_item From df911e610064779e8c8e10fa8824afef9d4737fc Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 12:24:59 +0100 Subject: [PATCH 12/34] feat: error handling for host --- roles/controller_hosts/defaults/main.yml | 1 + roles/controller_hosts/tasks/async_host.yml | 31 +++++++++++++++++++++ roles/controller_hosts/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_hosts/tasks/async_host.yml diff --git a/roles/controller_hosts/defaults/main.yml b/roles/controller_hosts/defaults/main.yml index db0def7d9..70bc10760 100644 --- a/roles/controller_hosts/defaults/main.yml +++ b/roles/controller_hosts/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_hosts_async_delay: "{{ aap_configuration_async_delay | controller_configuration_hosts_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_host_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_hosts/tasks/async_host.yml b/roles/controller_hosts/tasks/async_host.yml new file mode 100644 index 000000000..68ea16354 --- /dev/null +++ b/roles/controller_hosts/tasks/async_host.yml @@ -0,0 +1,31 @@ +--- +- name: async_host | An async_host block + block: + - name: async_host | Managing Controller hosts | Wait for finish the hosts management + ansible.builtin.async_status: + jid: "{{ __host_job_async_results_item.ansible_job_id }}" + register: __host_job_async_result + until: __host_job_async_result.finished + retries: "{{ controller_configuration_hosts_async_retries }}" + delay: "{{ controller_configuration_hosts_async_delay }}" + rescue: + - name: async_host | Load error details + ansible.builtin.include_vars: + file: "{{ __host_job_async_result.results_file }}" + name: __error_data + + - name: async_host | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_host | Building list of not processed hosts + ansible.builtin.set_fact: + __hosts_error_list: "{{ __hosts_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_hosts/tasks/main.yml b/roles/controller_hosts/tasks/main.yml index 727db93e7..c51b68478 100644 --- a/roles/controller_hosts/tasks/main.yml +++ b/roles/controller_hosts/tasks/main.yml @@ -36,12 +36,7 @@ when: ansible_check_mode and __host_job_async.failed is defined and __host_job_async.failed - name: Managing Controller Hosts | Wait for finish the Hosts management - ansible.builtin.async_status: - jid: "{{ __host_job_async_results_item.ansible_job_id }}" - register: __host_job_async_result - until: __host_job_async_result.finished - retries: "{{ controller_configuration_hosts_async_retries }}" - delay: "{{ controller_configuration_hosts_async_delay }}" + ansible.builtin.include_tasks: async_host.yml loop: "{{ __host_job_async.results }}" loop_control: loop_var: __host_job_async_results_item From 6009eac251899f982bab6e54760967ec214b04a6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 12:51:50 +0100 Subject: [PATCH 13/34] fix: task name --- roles/controller_applications/tasks/async_application.yml | 2 +- roles/controller_bulk_host_create/tasks/async_bulk_host.yml | 2 +- .../tasks/async_credential_input.yml | 2 +- .../tasks/async_credetnial_type.yml | 2 +- roles/controller_credentials/tasks/async_credential.yaml | 4 ++-- .../tasks/async_execution_environment.yml | 2 +- roles/controller_host_groups/tasks/async_host_group.yml | 2 +- roles/controller_hosts/tasks/async_host.yml | 2 +- roles/controller_projects/tasks/async_project.yml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/controller_applications/tasks/async_application.yml b/roles/controller_applications/tasks/async_application.yml index 1ceea74d4..5bf7102aa 100644 --- a/roles/controller_applications/tasks/async_application.yml +++ b/roles/controller_applications/tasks/async_application.yml @@ -1,7 +1,7 @@ --- - name: async_application | An async_application block block: - - name: async_application | Managing Controller applications | Wait for finish the applications management + - name: async_application | Managing Controller Applications | Wait for finish the applications management ansible.builtin.async_status: jid: "{{ __applications_job_async_result_item.ansible_job_id }}" register: __applications_job_async_result diff --git a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml index 7941bdc28..8697b8ed8 100644 --- a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml +++ b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml @@ -1,7 +1,7 @@ --- - name: async_bulk_host | An async_bulk_host block block: - - name: async_bulk_host | Managing Controller bulk_hosts | Wait for finish the bulk_hosts management + - name: async_bulk_host | Configure bulk_hosts | Wait for finish the bulk_hosts management ansible.builtin.async_status: jid: "{{ __controller_bulk_hosts_job_async_results_item.ansible_job_id }}" register: __controller_bulk_hosts_job_async_result diff --git a/roles/controller_credential_input_sources/tasks/async_credential_input.yml b/roles/controller_credential_input_sources/tasks/async_credential_input.yml index 4de4819f6..ec35b4e93 100644 --- a/roles/controller_credential_input_sources/tasks/async_credential_input.yml +++ b/roles/controller_credential_input_sources/tasks/async_credential_input.yml @@ -1,7 +1,7 @@ --- - name: async_credential_input | An async_credential_input block block: - - name: async_credential_input | Managing Controller bulk_hosts | Wait for finish the bulk_hosts management + - name: async_credential_input | Managing Credential Input Sources | Wait for finish the bulk_hosts management ansible.builtin.async_status: jid: "{{ __credential_input_sources_job_async_results_item.ansible_job_id }}" register: __credential_input_sources_job_async_result diff --git a/roles/controller_credential_types/tasks/async_credetnial_type.yml b/roles/controller_credential_types/tasks/async_credetnial_type.yml index fc14a2047..3fff8227c 100644 --- a/roles/controller_credential_types/tasks/async_credetnial_type.yml +++ b/roles/controller_credential_types/tasks/async_credetnial_type.yml @@ -1,7 +1,7 @@ --- - name: async_credential_type | An async_credential_type block block: - - name: async_credential_type | Managing Controller credential_types | Wait for finish the credential_types management + - name: async_credential_type | Managing Controller Credential Types | Wait for finish the credential_types management ansible.builtin.async_status: jid: "{{ __credentialtypes_job_async_result_item.ansible_job_id }}" register: __credentialtypes_job_async_result diff --git a/roles/controller_credentials/tasks/async_credential.yaml b/roles/controller_credentials/tasks/async_credential.yaml index 43e50864b..81b40de3a 100644 --- a/roles/controller_credentials/tasks/async_credential.yaml +++ b/roles/controller_credentials/tasks/async_credential.yaml @@ -1,9 +1,9 @@ --- - name: async_credential | An async_credential block block: - - name: async_credential | Managing Controller credentials | Wait for finish the credentials management + - name: async_credential | Managing Controller Credentials | Wait for finish the credentials management ansible.builtin.async_status: - jid: "{{ __credentials_job_async_result_item.ansible_job_id }}" + jid: "{{ __credentials_job_async_results_item.ansible_job_id }}" register: __credentials_job_async_result until: __credentials_job_async_result.finished retries: "{{ controller_configuration_credentials_async_retries }}" diff --git a/roles/controller_execution_environments/tasks/async_execution_environment.yml b/roles/controller_execution_environments/tasks/async_execution_environment.yml index 8a7f0a166..dd878ce54 100644 --- a/roles/controller_execution_environments/tasks/async_execution_environment.yml +++ b/roles/controller_execution_environments/tasks/async_execution_environment.yml @@ -1,7 +1,7 @@ --- - name: async_execution_environment | An async_execution_environment block block: - - name: async_execution_environment | Managing Controller credential_types | Wait for finish the credential_types management + - name: async_execution_environment | Managing Controller Execution Environments | Wait for finish the credential_types management ansible.builtin.async_status: jid: "{{ __execution_environments_job_async_result_item.ansible_job_id }}" register: __execution_environments_job_async_result diff --git a/roles/controller_host_groups/tasks/async_host_group.yml b/roles/controller_host_groups/tasks/async_host_group.yml index 4e87bf43a..75be2d890 100644 --- a/roles/controller_host_groups/tasks/async_host_group.yml +++ b/roles/controller_host_groups/tasks/async_host_group.yml @@ -1,7 +1,7 @@ --- - name: async_host_group | An async_host_group block block: - - name: async_host_group | Managing Controller credential_types | Wait for finish the credential_types management + - name: async_host_group | Managing Controller Groups Wait for finish the credential_types management ansible.builtin.async_status: jid: "{{ __group_job_async_results_item.ansible_job_id }}" register: __group_job_async_result diff --git a/roles/controller_hosts/tasks/async_host.yml b/roles/controller_hosts/tasks/async_host.yml index 68ea16354..b226a72d3 100644 --- a/roles/controller_hosts/tasks/async_host.yml +++ b/roles/controller_hosts/tasks/async_host.yml @@ -1,7 +1,7 @@ --- - name: async_host | An async_host block block: - - name: async_host | Managing Controller hosts | Wait for finish the hosts management + - name: async_host | Managing Controller Hosts | Wait for finish the hosts management ansible.builtin.async_status: jid: "{{ __host_job_async_results_item.ansible_job_id }}" register: __host_job_async_result diff --git a/roles/controller_projects/tasks/async_project.yml b/roles/controller_projects/tasks/async_project.yml index 46e8ea0f2..9ca242a03 100644 --- a/roles/controller_projects/tasks/async_project.yml +++ b/roles/controller_projects/tasks/async_project.yml @@ -1,7 +1,7 @@ --- - name: async_project | An async_project block block: - - name: async_project | Managing Controller projects | Wait for finish the Projects management + - name: async_project | Managing Controller Projects | Wait for finish the Projects management ansible.builtin.async_status: jid: "{{ __projects_job_async_results_item.ansible_job_id }}" register: __projects_job_async_result From 51d41419b5783488c3d78926a9daf6fcc000fd28 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 12:58:14 +0100 Subject: [PATCH 14/34] feat: error handling for instance groups --- .../defaults/main.yml | 1 + .../tasks/async_instance_group.yml | 31 +++++++++++++++++++ .../controller_instance_groups/tasks/main.yml | 9 ++---- 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 roles/controller_instance_groups/tasks/async_instance_group.yml diff --git a/roles/controller_instance_groups/defaults/main.yml b/roles/controller_instance_groups/defaults/main.yml index f9116c061..8aa42fa5a 100644 --- a/roles/controller_instance_groups/defaults/main.yml +++ b/roles/controller_instance_groups/defaults/main.yml @@ -6,4 +6,5 @@ controller_configuration_instance_groups_async_delay: "{{ aap_configuration_asyn controller_configuration_instance_groups_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_instance_groups_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_instance_groups/tasks/async_instance_group.yml b/roles/controller_instance_groups/tasks/async_instance_group.yml new file mode 100644 index 000000000..f234a0ff1 --- /dev/null +++ b/roles/controller_instance_groups/tasks/async_instance_group.yml @@ -0,0 +1,31 @@ +--- +- name: async_instance_group | An async_instance_group block + block: + - name: async_instance_group | Managing Controller Instance Groups | Wait for finish the hosts management + ansible.builtin.async_status: + jid: "{{ __instance_groups_job_async_results_item.ansible_job_id }}" + register: __instance_groups_job_async_result + until: __instance_groups_job_async_result.finished + retries: "{{ controller_configuration_instance_groups_async_retries }}" + delay: "{{ controller_configuration_instance_groups_async_delay }}" + rescue: + - name: async_instance_group | Load error details + ansible.builtin.include_vars: + file: "{{ __host_job_async_result.results_file }}" + name: __error_data + + - name: async_instance_group | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_instance_group | Building list of not processed hosts + ansible.builtin.set_fact: + __instance_group_error_list: "{{ __instance_group_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_instance_groups/tasks/main.yml b/roles/controller_instance_groups/tasks/main.yml index 0748acebf..bc02100d5 100644 --- a/roles/controller_instance_groups/tasks/main.yml +++ b/roles/controller_instance_groups/tasks/main.yml @@ -41,13 +41,8 @@ error_flag: true when: ansible_check_mode and __instance_groups_job_async.failed is defined and __instance_groups_job_async.failed -- name: Managing Controller instance groups | Wait for finish the instance groups management - ansible.builtin.async_status: - jid: "{{ __instance_groups_job_async_results_item.ansible_job_id }}" - register: __instance_groups_job_async_result - until: __instance_groups_job_async_result.finished - retries: "{{ controller_configuration_instance_groups_async_retries }}" - delay: "{{ controller_configuration_instance_groups_async_delay }}" +- name: Managing Controller Instance Groups | Wait for finish the instance groups management + ansible.builtin.include_tasks: async_instance_group.yml loop: "{{ __instance_groups_job_async.results }}" loop_control: loop_var: __instance_groups_job_async_results_item From facf2f67a797c593f82c0f20601aa3faf932e711 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 13:15:02 +0100 Subject: [PATCH 15/34] feat: error handling for instances --- roles/controller_instances/defaults/main.yml | 1 + .../tasks/async_instance.yml | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 roles/controller_instances/tasks/async_instance.yml diff --git a/roles/controller_instances/defaults/main.yml b/roles/controller_instances/defaults/main.yml index 2f64721ce..488fcd4f8 100644 --- a/roles/controller_instances/defaults/main.yml +++ b/roles/controller_instances/defaults/main.yml @@ -6,4 +6,5 @@ controller_configuration_instances_async_delay: "{{ aap_configuration_async_dela controller_configuration_instances_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_instances_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_instances/tasks/async_instance.yml b/roles/controller_instances/tasks/async_instance.yml new file mode 100644 index 000000000..d44435b39 --- /dev/null +++ b/roles/controller_instances/tasks/async_instance.yml @@ -0,0 +1,31 @@ +--- +- name: async_instance | An async_instance block + block: + - name: async_instance | Managing Controller Instances | Wait for finish the hosts management + ansible.builtin.async_status: + jid: "{{ __instance_job_async_results_item.ansible_job_id }}" + register: __instance_job_async_result + until: __instance_job_async_result.finished + retries: "{{ controller_configuration_instances_async_retries }}" + delay: "{{ controller_configuration_instances_async_delay }}" + rescue: + - name: async_instance | Load error details + ansible.builtin.include_vars: + file: "{{ __instance_job_async_result.results_file }}" + name: __error_data + + - name: async_instance | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_instance | Building list of not processed hosts + ansible.builtin.set_fact: + __instance_error_list: "{{ __instance_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... From 44ec144f2c44801982a18d9d2a8edcf363be8d64 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 13:18:03 +0100 Subject: [PATCH 16/34] feat: error handling for inventories --- .../controller_inventories/defaults/main.yml | 1 + .../tasks/async_inventory.yml | 31 +++++++++++++++++++ roles/controller_inventories/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_inventories/tasks/async_inventory.yml diff --git a/roles/controller_inventories/defaults/main.yml b/roles/controller_inventories/defaults/main.yml index b88d7e727..24c9497e3 100644 --- a/roles/controller_inventories/defaults/main.yml +++ b/roles/controller_inventories/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_inventories_async_delay: "{{ aap_configuration_async_de controller_configuration_inventories_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_inventories_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_inventories/tasks/async_inventory.yml b/roles/controller_inventories/tasks/async_inventory.yml new file mode 100644 index 000000000..03c390896 --- /dev/null +++ b/roles/controller_inventories/tasks/async_inventory.yml @@ -0,0 +1,31 @@ +--- +- name: async_inventory | An async_inventory block + block: + - name: async_inventory | Managing Controller Inventories | Wait for finish the inventories management + ansible.builtin.async_status: + jid: "{{ __inventories_job_async_result_item.ansible_job_id }}" + register: __inventories_job_async_result + until: __inventories_job_async_result.finished + retries: "{{ controller_configuration_inventories_async_retries }}" + delay: "{{ controller_configuration_inventories_async_delay }}" + rescue: + - name: async_inventory | Load error details + ansible.builtin.include_vars: + file: "{{ __inventories_job_async_result.results_file }}" + name: __error_data + + - name: async_inventory | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_inventory | Building list of not processed inventories + ansible.builtin.set_fact: + __inventories_error_list: "{{ __inventories_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_inventories/tasks/main.yml b/roles/controller_inventories/tasks/main.yml index f0092fccc..7cce9e73e 100644 --- a/roles/controller_inventories/tasks/main.yml +++ b/roles/controller_inventories/tasks/main.yml @@ -41,12 +41,7 @@ when: ansible_check_mode and __inventories_job_async.failed is defined and __inventories_job_async.failed - name: Managing Controller Inventories | Wait for finish the inventories management - ansible.builtin.async_status: - jid: "{{ __inventories_job_async_result_item.ansible_job_id }}" - register: __inventories_job_async_result - until: __inventories_job_async_result.finished - retries: "{{ controller_configuration_inventories_async_retries }}" - delay: "{{ controller_configuration_inventories_async_delay }}" + ansible.builtin.include_tasks: async_inventory.yml loop: "{{ __inventories_job_async.results }}" loop_control: loop_var: __inventories_job_async_result_item From b746c2e8c569c680a0d8b7c12fcb5064c20011bb Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 13:30:07 +0100 Subject: [PATCH 17/34] feat: error handling for inventory source update --- .../defaults/main.yml | 1 + .../tasks/async_inventory_source_update.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 9 ++---- 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml diff --git a/roles/controller_inventory_source_update/defaults/main.yml b/roles/controller_inventory_source_update/defaults/main.yml index b49fa2ea8..0e989cc02 100644 --- a/roles/controller_inventory_source_update/defaults/main.yml +++ b/roles/controller_inventory_source_update/defaults/main.yml @@ -4,4 +4,5 @@ controller_configuration_inventory_source_update_async_retries: "{{ aap_configur controller_configuration_inventory_source_update_async_delay: "{{ aap_configuration_async_delay | default(1) }}" controller_configuration_inventory_source_update_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: +collect_logs: false ... diff --git a/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml new file mode 100644 index 000000000..f01badd0c --- /dev/null +++ b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml @@ -0,0 +1,31 @@ +--- +- name: async_inventory_source_update | An async_inventory_source_update block + block: + - name: async_inventory_source_update | Managing Controller inventories | Wait for finish the inventories management + ansible.builtin.async_status: + jid: "{{ __inventory_source_update_async_results_item.ansible_job_id }}" + register: __inventory_source_update_async_result + until: __inventory_source_update_async_result.finished + retries: "{{ controller_configuration_inventory_source_update_async_retries }}" + delay: "{{ controller_configuration_inventory_source_update_async_delay }}" + rescue: + - name: async_inventory_source_update | Load error details + ansible.builtin.include_vars: + file: "{{ __inventory_source_update_async_result.results_file }}" + name: __error_data + + - name: async_inventory_source_update | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_inventory_source_update | Building list of not processed inventories + ansible.builtin.set_fact: + __inventory_source_update_error_list: "{{ __inventory_source_update_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_inventory_source_update/tasks/main.yml b/roles/controller_inventory_source_update/tasks/main.yml index 8d8e4517a..acf95bd12 100644 --- a/roles/controller_inventory_source_update/tasks/main.yml +++ b/roles/controller_inventory_source_update/tasks/main.yml @@ -37,13 +37,8 @@ error_flag: true when: ansible_check_mode and __inventory_source_update_async.failed is defined and __inventory_source_update_async.failed -- name: Controller inventory source update | Wait for finish of the inventory source update - ansible.builtin.async_status: - jid: "{{ __inventory_source_update_async_results_item.ansible_job_id }}" - register: __inventory_source_update_async_result - until: __inventory_source_update_async_result.finished - retries: "{{ controller_configuration_inventory_source_update_async_retries }}" - delay: "{{ controller_configuration_inventory_source_update_async_delay }}" +- name: Controller Inventory Source Update | Wait for finish of the inventory source update + ansible.builtin.include_tasks: async_inventory_source_update.yml loop: "{{ __inventory_source_update_async.results }}" loop_control: loop_var: __inventory_source_update_async_results_item From b18af57222b5cab3b84b5c877280b93525352c52 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 13:32:07 +0100 Subject: [PATCH 18/34] feat: error handling for inventory sources --- .../defaults/main.yml | 1 + .../tasks/async_inventory_source.yml | 31 +++++++++++++++++++ .../tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_inventory_sources/tasks/async_inventory_source.yml diff --git a/roles/controller_inventory_sources/defaults/main.yml b/roles/controller_inventory_sources/defaults/main.yml index 4b6d1ae21..7b0be7848 100644 --- a/roles/controller_inventory_sources/defaults/main.yml +++ b/roles/controller_inventory_sources/defaults/main.yml @@ -6,4 +6,5 @@ controller_configuration_inventory_sources_async_delay: "{{ aap_configuration_as controller_configuration_inventory_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_inventory_sources_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_inventory_sources/tasks/async_inventory_source.yml b/roles/controller_inventory_sources/tasks/async_inventory_source.yml new file mode 100644 index 000000000..574dfa440 --- /dev/null +++ b/roles/controller_inventory_sources/tasks/async_inventory_source.yml @@ -0,0 +1,31 @@ +--- +- name: async_inventory_source | An async_inventory_source block + block: + - name: async_inventory_source | Managing Controller Inventory Sources | Wait for finish the inventory_sources management + ansible.builtin.async_status: + jid: "{{ __inventory_source_job_async_results_item.ansible_job_id }}" + register: __inventory_source_job_async_result + until: __inventory_source_job_async_result.finished + retries: "{{ controller_configuration_inventory_sources_async_retries }}" + delay: "{{ controller_configuration_inventory_sources_async_delay }}" + rescue: + - name: async_inventory_source | Load error details + ansible.builtin.include_vars: + file: "{{ __inventory_source_job_async_result.results_file }}" + name: __error_data + + - name: async_inventory_source | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_inventory_source | Building list of not processed inventory_sources + ansible.builtin.set_fact: + __inventory_sources_error_list: "{{ __inventory_sources_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_inventory_sources/tasks/main.yml b/roles/controller_inventory_sources/tasks/main.yml index ea0c7bc1b..33723c7a2 100644 --- a/roles/controller_inventory_sources/tasks/main.yml +++ b/roles/controller_inventory_sources/tasks/main.yml @@ -57,12 +57,7 @@ when: ansible_check_mode and __inventory_source_job_async.failed is defined and __inventory_source_job_async.failed - name: Managing Inventory Sources | Wait for finish the Inventory Sources management - ansible.builtin.async_status: - jid: "{{ __inventory_source_job_async_results_item.ansible_job_id }}" - register: __inventory_source_job_async_result - until: __inventory_source_job_async_result.finished - retries: "{{ controller_configuration_inventory_sources_async_retries }}" - delay: "{{ controller_configuration_inventory_sources_async_delay }}" + ansible.builtin.include_tasks: async_inventory_sources.yml loop: "{{ __inventory_source_job_async.results }}" loop_control: loop_var: __inventory_source_job_async_results_item From 1012527a2f806b58770f4583cb4d995768681fac Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 13:52:19 +0100 Subject: [PATCH 19/34] feat: error handling for notification templates --- .../tasks/async_notification_template.yml | 33 +++++++++++++++++++ .../tasks/main.yml | 7 +--- 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 roles/controller_notification_templates/tasks/async_notification_template.yml diff --git a/roles/controller_notification_templates/tasks/async_notification_template.yml b/roles/controller_notification_templates/tasks/async_notification_template.yml new file mode 100644 index 000000000..fb9fbfcc6 --- /dev/null +++ b/roles/controller_notification_templates/tasks/async_notification_template.yml @@ -0,0 +1,33 @@ +--- +- name: async_notification_template | An async_notification_template block + block: + - name: async_notification_template | Managing Controller Notification Templates | Wait for finish the Job Templates management + ansible.builtin.async_status: + jid: "{{ __controller_notification_job_async_results_item.ansible_job_id }}" + register: __controller_notification_job_async_result + until: __controller_notification_job_async_result.finished + retries: "{{ controller_configuration_notifications_async_retries }}" + delay: "{{ controller_configuration_notifications_async_delay }}" + + rescue: + + - name: async_notification_template | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_notification_job_async_result.results_file }}" + name: __error_data + + - name: async_notification_template | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_notification_template | Building list of not processed templates + ansible.builtin.set_fact: + __notification_templates_error_list: "{{ __notification_templates_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_notification_templates/tasks/main.yml b/roles/controller_notification_templates/tasks/main.yml index 59ef8919c..47a921a0a 100644 --- a/roles/controller_notification_templates/tasks/main.yml +++ b/roles/controller_notification_templates/tasks/main.yml @@ -38,12 +38,7 @@ when: ansible_check_mode and __controller_notification_job_async.failed is defined and __controller_notification_job_async.failed - name: Managing Notifications | Wait for finish the Notifications management - ansible.builtin.async_status: - jid: "{{ __controller_notification_job_async_results_item.ansible_job_id }}" - register: __controller_notification_job_async_result - until: __controller_notification_job_async_result.finished - retries: "{{ controller_configuration_notifications_async_retries }}" - delay: "{{ controller_configuration_notifications_async_delay }}" + ansible.builtin.include_tasks: async_notification_template.yml loop: "{{ __controller_notification_job_async.results }}" loop_control: loop_var: __controller_notification_job_async_results_item From 4f07a2575dafc264f75a680ecd3acef37e664ca2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:14:18 +0100 Subject: [PATCH 20/34] feat: error handling for organization --- .../defaults/main.yml | 1 + .../tasks/async_organization.yml | 33 +++++++++++++++++++ roles/controller_organizations/tasks/main.yml | 7 +--- 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 roles/controller_organizations/tasks/async_organization.yml diff --git a/roles/controller_organizations/defaults/main.yml b/roles/controller_organizations/defaults/main.yml index e8dee3d4e..c28946cde 100644 --- a/roles/controller_organizations/defaults/main.yml +++ b/roles/controller_organizations/defaults/main.yml @@ -10,4 +10,5 @@ assign_galaxy_credentials_to_org: true assign_default_ee_to_org: true assign_notification_templates_to_org: true assign_instance_groups_to_org: true +collect_logs: false ... diff --git a/roles/controller_organizations/tasks/async_organization.yml b/roles/controller_organizations/tasks/async_organization.yml new file mode 100644 index 000000000..27a7b9fce --- /dev/null +++ b/roles/controller_organizations/tasks/async_organization.yml @@ -0,0 +1,33 @@ +--- +- name: async_organization | An async_organization block + block: + - name: async_organization | Managing Controller Organizations | Wait for finish the Job Templates management + ansible.builtin.async_status: + jid: "{{ __organizations_job_async_results_item.ansible_job_id }}" + register: __organizations_job_async_result + until: __organizations_job_async_result.finished + retries: "{{ controller_configuration_organizations_async_retries }}" + delay: "{{ controller_configuration_organizations_async_delay }}" + + rescue: + + - name: async_organization | Load error details + ansible.builtin.include_vars: + file: "{{ __organizations_job_async_result.results_file }}" + name: __error_data + + - name: async_organization | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_organization | Building list of not processed templates + ansible.builtin.set_fact: + __organizations_error_list: "{{ __organizations_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_organizations/tasks/main.yml b/roles/controller_organizations/tasks/main.yml index 757cc0a31..e2b4cb32b 100644 --- a/roles/controller_organizations/tasks/main.yml +++ b/roles/controller_organizations/tasks/main.yml @@ -42,12 +42,7 @@ when: ansible_check_mode and __organizations_job_async.failed is defined and __organizations_job_async.failed - name: Managing Controller Organizations | Wait for finish the Organizations management - ansible.builtin.async_status: - jid: "{{ __organizations_job_async_results_item.ansible_job_id }}" - register: __organizations_job_async_result - until: __organizations_job_async_result.finished - retries: "{{ controller_configuration_organizations_async_retries }}" - delay: "{{ controller_configuration_organizations_async_delay }}" + ansible.builtin.include_tasks: async_organization.yml loop: "{{ __organizations_job_async.results }}" loop_control: loop_var: __organizations_job_async_results_item From c44ac85deb2bd4264b7857b8c1a392fb830636a5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:14:36 +0100 Subject: [PATCH 21/34] feat: error handling for project updates --- .../defaults/main.yml | 1 + .../tasks/async_project_update.yml | 31 +++++++++++++++++++ .../controller_project_update/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_project_update/tasks/async_project_update.yml diff --git a/roles/controller_project_update/defaults/main.yml b/roles/controller_project_update/defaults/main.yml index 4bf47dbaa..46fd98fda 100644 --- a/roles/controller_project_update/defaults/main.yml +++ b/roles/controller_project_update/defaults/main.yml @@ -4,4 +4,5 @@ controller_configuration_project_update_async_retries: "{{ aap_configuration_asy controller_configuration_project_update_async_delay: "{{ aap_configuration_async_delay | default(10) }}" controller_configuration_project_update_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: +collect_logs: false ... diff --git a/roles/controller_project_update/tasks/async_project_update.yml b/roles/controller_project_update/tasks/async_project_update.yml new file mode 100644 index 000000000..39f16e3dc --- /dev/null +++ b/roles/controller_project_update/tasks/async_project_update.yml @@ -0,0 +1,31 @@ +--- +- name: async_project_update | An async_project_update block + block: + - name: async_project_update | Configure Controller Projects | Wait for finish the Projects management + ansible.builtin.async_status: + jid: "{{ __project_update_job_async_results_item.ansible_job_id }}" + register: __project_update_job_async_result + until: __project_update_job_async_result.finished + retries: "{{ controller_configuration_project_update_async_retries }}" + delay: "{{ controller_configuration_project_update_async_delay }}" + rescue: + - name: async_project_update | Load error details + ansible.builtin.include_vars: + file: "{{ __project_update_job_async_result.results_file }}" + name: __error_data + + - name: async_project_update | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_project_update | Building list of not processed projects + ansible.builtin.set_fact: + __project_updates_error_list: "{{ __project_updates_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_project_update/tasks/main.yml b/roles/controller_project_update/tasks/main.yml index cab4f0228..2f23d711d 100644 --- a/roles/controller_project_update/tasks/main.yml +++ b/roles/controller_project_update/tasks/main.yml @@ -38,12 +38,7 @@ when: ansible_check_mode and __project_update_job_async.failed is defined and __project_update_job_async.failed - name: Configure Controller Projects | Wait for finish the projects update - ansible.builtin.async_status: - jid: "{{ __project_update_job_async_results_item.ansible_job_id }}" - register: __project_update_job_async_result - until: __project_update_job_async_result.finished - retries: "{{ controller_configuration_project_update_async_retries }}" - delay: "{{ controller_configuration_project_update_async_delay }}" + ansible.builtin.include_tasks: async_project_update.yml loop: "{{ __project_update_job_async.results }}" loop_control: loop_var: __project_update_job_async_results_item From 9437f28c55696b18a7bc11cdc4cccf727191903d Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:20:49 +0100 Subject: [PATCH 22/34] feat: error handling for roles --- roles/controller_roles/defaults/main.yml | 1 + roles/controller_roles/tasks/async_role.yml | 31 +++++++++++++++++++++ roles/controller_roles/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_roles/tasks/async_role.yml diff --git a/roles/controller_roles/defaults/main.yml b/roles/controller_roles/defaults/main.yml index 485b30bb2..23c937a7f 100644 --- a/roles/controller_roles/defaults/main.yml +++ b/roles/controller_roles/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_role_async_delay: "{{ aap_configuration_async_delay | d controller_configuration_role_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_role_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_roles/tasks/async_role.yml b/roles/controller_roles/tasks/async_role.yml new file mode 100644 index 000000000..d3059ab24 --- /dev/null +++ b/roles/controller_roles/tasks/async_role.yml @@ -0,0 +1,31 @@ +--- +- name: async_role | An async_role block + block: + - name: async_role | Managing Roles | Wait for finish the Projects management + ansible.builtin.async_status: + jid: "{{ __controller_role_job_async_results_item.ansible_job_id }}" + register: __controller_role_job_async_result + until: __controller_role_job_async_result.finished + retries: "{{ controller_configuration_role_async_retries }}" + delay: "{{ controller_configuration_role_async_delay }}" + rescue: + - name: async_role | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_role_job_async_result.results_file }}" + name: __error_data + + - name: async_role | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_role | Building list of not processed roles + ansible.builtin.set_fact: + __roles_error_list: "{{ __roles_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_roles/tasks/main.yml b/roles/controller_roles/tasks/main.yml index 86c9ec90f..3d0c7cef9 100644 --- a/roles/controller_roles/tasks/main.yml +++ b/roles/controller_roles/tasks/main.yml @@ -51,12 +51,7 @@ when: ansible_check_mode and __controller_role_job_async.failed is defined and __controller_role_job_async.failed - name: Managing Roles | Wait for finish the Roles management - ansible.builtin.async_status: - jid: "{{ __controller_role_job_async_results_item.ansible_job_id }}" - register: __controller_role_job_async_result - until: __controller_role_job_async_result.finished - retries: "{{ controller_configuration_role_async_retries }}" - delay: "{{ controller_configuration_role_async_delay }}" + ansible.builtin.include_tasks: async_role.yml loop: "{{ __controller_role_job_async.results }}" loop_control: loop_var: __controller_role_job_async_results_item From 85d475b7c7e01183da43d2ef729d6189634c67d5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:22:20 +0100 Subject: [PATCH 23/34] feat: error handling for schedules --- roles/controller_schedules/defaults/main.yml | 1 + .../tasks/async_schedule.yml | 31 +++++++++++++++++++ roles/controller_schedules/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_schedules/tasks/async_schedule.yml diff --git a/roles/controller_schedules/defaults/main.yml b/roles/controller_schedules/defaults/main.yml index edf2926f7..7fe2e6e25 100644 --- a/roles/controller_schedules/defaults/main.yml +++ b/roles/controller_schedules/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_schedules_async_delay: "{{ aap_configuration_async_dela controller_configuration_schedules_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_schedules_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_schedules/tasks/async_schedule.yml b/roles/controller_schedules/tasks/async_schedule.yml new file mode 100644 index 000000000..cd9ef705f --- /dev/null +++ b/roles/controller_schedules/tasks/async_schedule.yml @@ -0,0 +1,31 @@ +--- +- name: async_schedule | An async_schedule block + block: + - name: async_schedule | Managing Schedules | Wait for finish the schedules management + ansible.builtin.async_status: + jid: "{{ __controller_schedule_job_async_results_item.ansible_job_id }}" + register: __controller_schedules_job_async_result + until: __controller_schedules_job_async_result.finished + retries: "{{ controller_configuration_schedules_async_retries }}" + delay: "{{ controller_configuration_schedules_async_delay }}" + rescue: + - name: async_schedule | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_schedules_job_async_result.results_file }}" + name: __error_data + + - name: async_schedule | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_schedule | Building list of not processed schedules + ansible.builtin.set_fact: + __schedules_error_list: "{{ __schedules_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_schedules/tasks/main.yml b/roles/controller_schedules/tasks/main.yml index c66e4d367..76eb8278d 100644 --- a/roles/controller_schedules/tasks/main.yml +++ b/roles/controller_schedules/tasks/main.yml @@ -53,12 +53,7 @@ when: ansible_check_mode and __controller_schedule_job_async.failed is defined and __controller_schedule_job_async.failed - name: Managing Schedules | Wait for finish the Schedules management - ansible.builtin.async_status: - jid: "{{ __controller_schedule_job_async_results_item.ansible_job_id }}" - register: __controller_schedule_job_async_result - until: __controller_schedule_job_async_result.finished - retries: "{{ controller_configuration_schedules_async_retries }}" - delay: "{{ controller_configuration_schedules_async_delay }}" + ansible.builtin.include_tasks: async_schedule.yml loop: "{{ __controller_schedule_job_async.results }}" loop_control: loop_var: __controller_schedule_job_async_results_item From 206d5e6f04f490eebc47bde8f062d8d158c35f65 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:31:40 +0100 Subject: [PATCH 24/34] feat: error handling for teams --- roles/controller_teams/defaults/main.yml | 1 + roles/controller_teams/tasks/async_team.yml | 31 +++++++++++++++++++++ roles/controller_teams/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_teams/tasks/async_team.yml diff --git a/roles/controller_teams/defaults/main.yml b/roles/controller_teams/defaults/main.yml index a50146da3..edd84bd00 100644 --- a/roles/controller_teams/defaults/main.yml +++ b/roles/controller_teams/defaults/main.yml @@ -7,4 +7,5 @@ controller_configuration_platform_teams_async_delay: "{{ aap_configuration_async controller_configuration_teams_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_platform_teams_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_teams/tasks/async_team.yml b/roles/controller_teams/tasks/async_team.yml new file mode 100644 index 000000000..60dfc304b --- /dev/null +++ b/roles/controller_teams/tasks/async_team.yml @@ -0,0 +1,31 @@ +--- +- name: async_team | An async_team block + block: + - name: async_team | Managing Teams | Wait for finish the teams management + ansible.builtin.async_status: + jid: "{{ __controller_team_job_async_results_item.ansible_job_id }}" + register: __controller_team_job_async_result + until: __controller_team_job_async_result.finished + retries: "{{ controller_configuration_platform_teams_async_retries }}" + delay: "{{ controller_configuration_platform_teams_async_delay }}" + rescue: + - name: async_team | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_team_job_async_result.results_file }}" + name: __error_data + + - name: async_team | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_team | Building list of not processed teams + ansible.builtin.set_fact: + __teams_error_list: "{{ __teams_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_teams/tasks/main.yml b/roles/controller_teams/tasks/main.yml index 7c6bee6f9..a621c5beb 100644 --- a/roles/controller_teams/tasks/main.yml +++ b/roles/controller_teams/tasks/main.yml @@ -34,12 +34,7 @@ when: ansible_check_mode and __controller_team_job_async.failed is defined and __controller_team_job_async.failed - name: Managing Teams | Wait for finish the Teams management - ansible.builtin.async_status: - jid: "{{ __controller_team_job_async_results_item.ansible_job_id }}" - register: __controller_team_job_async_result - until: __controller_team_job_async_result.finished - retries: "{{ controller_configuration_platform_teams_async_retries }}" - delay: "{{ controller_configuration_platform_teams_async_delay }}" + ansible.builtin.include_tasks: async_team.yml loop: "{{ __controller_team_job_async.results }}" loop_control: loop_var: __controller_team_job_async_results_item From 5f5ce0bc3aee78c6a675914a90bb19f73ce780e2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:36:30 +0100 Subject: [PATCH 25/34] feat: error handling for users --- roles/controller_users/defaults/main.yml | 1 + roles/controller_users/tasks/async_user.yml | 31 +++++++++++++++++++++ roles/controller_users/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_users/tasks/async_user.yml diff --git a/roles/controller_users/defaults/main.yml b/roles/controller_users/defaults/main.yml index 73fe58947..e89036d8d 100644 --- a/roles/controller_users/defaults/main.yml +++ b/roles/controller_users/defaults/main.yml @@ -11,4 +11,5 @@ controller_configuration_users_async_delay: "{{ aap_configuration_async_delay | controller_configuration_users_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: controller_configuration_users_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}" +collect_logs: false ... diff --git a/roles/controller_users/tasks/async_user.yml b/roles/controller_users/tasks/async_user.yml new file mode 100644 index 000000000..0b8bf3404 --- /dev/null +++ b/roles/controller_users/tasks/async_user.yml @@ -0,0 +1,31 @@ +--- +- name: async_user | An async_user block + block: + - name: async_user | Managing Users | Wait for finish the users management + ansible.builtin.async_status: + jid: "{{ __controller_user_accounts_job_async_results_item.ansible_job_id }}" + register: __controller_user_accounts_job_async_result + until: __controller_user_accounts_job_async_result.finished + retries: "{{ controller_configuration_users_async_retries }}" + delay: "{{ controller_configuration_users_async_delay }}" + rescue: + - name: async_user | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_user_accounts_job_async_result.results_file }}" + name: __error_data + + - name: async_user | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_user | Building list of not processed users + ansible.builtin.set_fact: + __users_error_list: "{{ __users_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_users/tasks/main.yml b/roles/controller_users/tasks/main.yml index aff3ae854..037d7d563 100644 --- a/roles/controller_users/tasks/main.yml +++ b/roles/controller_users/tasks/main.yml @@ -43,12 +43,7 @@ when: ansible_check_mode and __controller_user_accounts_job_async.failed is defined and __controller_user_accounts_job_async.failed - name: Managing Users | Wait for finish the Users management - ansible.builtin.async_status: - jid: "{{ __controller_user_accounts_job_async_results_item.ansible_job_id }}" - register: __controller_user_accounts_job_async_result - until: __controller_user_accounts_job_async_result.finished - retries: "{{ controller_configuration_users_async_retries }}" - delay: "{{ controller_configuration_users_async_delay }}" + ansible.builtin.include_tasks: async_user.yml loop: "{{ __controller_user_accounts_job_async.results }}" loop_control: loop_var: __controller_user_accounts_job_async_results_item From 39b9502df01f4898c2069217cd5b3fe928af0c6f Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:39:21 +0100 Subject: [PATCH 26/34] feat: error handling for labels --- roles/controller_labels/defaults/main.yml | 1 + roles/controller_labels/tasks/async_label.yml | 31 +++++++++++++++++++ roles/controller_labels/tasks/main.yml | 7 +---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/controller_labels/tasks/async_label.yml diff --git a/roles/controller_labels/defaults/main.yml b/roles/controller_labels/defaults/main.yml index 5b0c0ed07..fe22f2835 100644 --- a/roles/controller_labels/defaults/main.yml +++ b/roles/controller_labels/defaults/main.yml @@ -5,4 +5,5 @@ controller_configuration_labels_async_retries: "{{ aap_configuration_async_retri controller_configuration_labels_async_delay: "{{ aap_configuration_async_delay | default(1) }}" controller_configuration_labels_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}" aap_configuration_async_dir: +collect_logs: false ... diff --git a/roles/controller_labels/tasks/async_label.yml b/roles/controller_labels/tasks/async_label.yml new file mode 100644 index 000000000..66fb544ce --- /dev/null +++ b/roles/controller_labels/tasks/async_label.yml @@ -0,0 +1,31 @@ +--- +- name: async_label | An async_label block + block: + - name: async_label | Managing labels | Wait for finish the labels management + ansible.builtin.async_status: + jid: "{{ __controller_label_job_async_results_item.ansible_job_id }}" + register: __controller_label_job_async_result + until: __controller_label_job_async_result.finished + retries: "{{ controller_configuration_labels_async_retries }}" + delay: "{{ controller_configuration_labels_async_delay }}" + rescue: + - name: async_label | Load error details + ansible.builtin.include_vars: + file: "{{ __controller_label_job_async_result.results_file }}" + name: __error_data + + - name: async_label | Show error and stop execution + when: not collect_logs + ansible.builtin.fail: + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + + - name: async_label | Building list of not processed labels + ansible.builtin.set_fact: + __labels_error_list: "{{ __labels_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" +... diff --git a/roles/controller_labels/tasks/main.yml b/roles/controller_labels/tasks/main.yml index b7fe90072..f9301d236 100644 --- a/roles/controller_labels/tasks/main.yml +++ b/roles/controller_labels/tasks/main.yml @@ -33,12 +33,7 @@ when: ansible_check_mode and __controller_label_job_async.failed is defined and __controller_label_job_async.failed - name: Managing Labels | Wait for finish the Labels management - ansible.builtin.async_status: - jid: "{{ __controller_label_job_async_results_item.ansible_job_id }}" - register: __controller_label_job_async_result - until: __controller_label_job_async_result.finished - retries: "{{ controller_configuration_labels_async_retries }}" - delay: "{{ controller_configuration_labels_async_delay }}" + ansible.builtin.include_tasks: async_label.yml loop: "{{ __controller_label_job_async.results }}" loop_control: loop_var: __controller_label_job_async_results_item From 6bb1c499cf5826bca983f03bf781c7e473ebffb8 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 14:44:18 +0100 Subject: [PATCH 27/34] misc: minor linting --- .../tasks/async_template.yml | 15 +++++++-------- .../tasks/async_workflow.yml | 2 +- .../tasks/async_workflow_node.yml | 2 +- .../tasks/async_workflow_node_link.yml | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/roles/controller_job_templates/tasks/async_template.yml b/roles/controller_job_templates/tasks/async_template.yml index a04090a65..a8d4f9c99 100644 --- a/roles/controller_job_templates/tasks/async_template.yml +++ b/roles/controller_job_templates/tasks/async_template.yml @@ -8,7 +8,6 @@ until: __job_templates_job_async_result.finished retries: "{{ controller_configuration_job_templates_async_template_retries }}" delay: "{{ controller_configuration_job_templates_async_template_delay }}" - rescue: - name: async_template | Removing variables existance from result_file ansible.builtin.replace: @@ -30,13 +29,13 @@ ansible.builtin.set_fact: __templates_error_list: "{{ __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'], - 'response': __error_data['response'] + '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'], + 'response': __error_data['response'] } ] }}" diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow.yml b/roles/controller_workflow_job_templates/tasks/async_workflow.yml index 30a3ee472..2a5ccd341 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow.yml @@ -28,5 +28,5 @@ 'error': __error_data['msg'] | default(__workflows_job_async_result['msg']) } ] - }}" + }}" ... diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml index 39e13e8c3..4996d3fe2 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml @@ -28,5 +28,5 @@ 'error': __error_data['msg'] | default(__workflows_node_async_result['msg']) } ] - }}" + }}" ... diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml index c329b15fd..6113d1757 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml @@ -29,5 +29,5 @@ 'error': __error_data['msg'] | default(__workflows_link_async_result['msg']) } ] - }}" + }}" ... From 81dd38f6f254968718ae8e2cd247fd1742781e75 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 15:04:15 +0100 Subject: [PATCH 28/34] misc: update readmes --- roles/controller_applications/README.md | 1 + roles/controller_bulk_host_create/README.md | 1 + roles/controller_credential_input_sources/README.md | 1 + roles/controller_credential_types/README.md | 1 + roles/controller_execution_environments/README.md | 1 + roles/controller_host_groups/README.md | 1 + roles/controller_hosts/README.md | 1 + roles/controller_instance_groups/README.md | 1 + roles/controller_instances/README.md | 1 + roles/controller_inventories/README.md | 1 + roles/controller_inventory_source_update/README.md | 1 + roles/controller_inventory_sources/README.md | 1 + roles/controller_job_templates/README.md | 1 + roles/controller_labels/README.md | 1 + roles/controller_notification_templates/README.md | 1 + roles/controller_project_update/README.md | 1 + roles/controller_projects/README.md | 1 + roles/controller_roles/README.md | 1 + roles/controller_schedules/README.md | 1 + roles/controller_teams/README.md | 1 + roles/controller_users/README.md | 1 + roles/controller_workflow_job_templates/README.md | 1 + 22 files changed, 22 insertions(+) diff --git a/roles/controller_applications/README.md b/roles/controller_applications/README.md index 25db4f2dc..f372662ad 100644 --- a/roles/controller_applications/README.md +++ b/roles/controller_applications/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`aap_applications`|`see below`|yes|Data structure describing your applications, described below. Alias: applications || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to application creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_bulk_host_create/README.md b/roles/controller_bulk_host_create/README.md index ccd7bf682..0a4484d7a 100644 --- a/roles/controller_bulk_host_create/README.md +++ b/roles/controller_bulk_host_create/README.md @@ -23,6 +23,7 @@ Currently: |`controller_oauthtoken`|""|no|Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`controller_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_configuration_bulk_hosts_secure_logging`|`see below`|yes|Data structure describing your organization or organizations Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to bulk host creation instead of failing on the first error.|| ### Secure Logging Variables diff --git a/roles/controller_credential_input_sources/README.md b/roles/controller_credential_input_sources/README.md index 3e4849151..12e2e7b22 100644 --- a/roles/controller_credential_input_sources/README.md +++ b/roles/controller_credential_input_sources/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_credential_input_sources`|`see below`|yes|Data structure describing your credential input sources Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to credential input sources creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_credential_types/README.md b/roles/controller_credential_types/README.md index 281ea5981..d6b354a35 100644 --- a/roles/controller_credential_types/README.md +++ b/roles/controller_credential_types/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_credential_types`|`see below`|yes|Data structure describing your credential types Described below. Alias: credential_types || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to credential type creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_execution_environments/README.md b/roles/controller_execution_environments/README.md index 2627c6f4b..4145ea346 100644 --- a/roles/controller_execution_environments/README.md +++ b/roles/controller_execution_environments/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_execution_environments`|`see below`|yes|Data structure describing your organization or organizations Described below. Alias: execution_environments || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to execution envirionment creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_host_groups/README.md b/roles/controller_host_groups/README.md index 332cf41af..b791c7258 100644 --- a/roles/controller_host_groups/README.md +++ b/roles/controller_host_groups/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_groups`|`see below`|yes|Data structure describing your group or groups Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to group creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_hosts/README.md b/roles/controller_hosts/README.md index a1378b946..3c20bd333 100644 --- a/roles/controller_hosts/README.md +++ b/roles/controller_hosts/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_hosts`|`see below`|yes|Data structure describing your host entries described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to host creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_instance_groups/README.md b/roles/controller_instance_groups/README.md index f0cd6989d..1f712992a 100644 --- a/roles/controller_instance_groups/README.md +++ b/roles/controller_instance_groups/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_instance_groups`|`see below`|yes|Data structure describing your instance groups Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to instance group creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_instances/README.md b/roles/controller_instances/README.md index 117ae0ef7..ece9947bd 100644 --- a/roles/controller_instances/README.md +++ b/roles/controller_instances/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_instances`|`see below`|yes|Data structure describing your instances Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to instance creation, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_inventories/README.md b/roles/controller_inventories/README.md index 78278f474..72ab106e4 100644 --- a/roles/controller_inventories/README.md +++ b/roles/controller_inventories/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_inventories`|`see below`|yes|Data structure describing your inventories described below. Alias: inventory || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to inventory creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_inventory_source_update/README.md b/roles/controller_inventory_source_update/README.md index 97ea3f31f..3ac88dbf0 100644 --- a/roles/controller_inventory_source_update/README.md +++ b/roles/controller_inventory_source_update/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_inventory_sources`|`see below`|yes|Data structure describing controller inventory sources to update Described below. Alias: inventory_sources || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to inventory sources update, instead of failing on the first error.|| ### Secure Logging Variables diff --git a/roles/controller_inventory_sources/README.md b/roles/controller_inventory_sources/README.md index fe84c705a..863f1f70a 100644 --- a/roles/controller_inventory_sources/README.md +++ b/roles/controller_inventory_sources/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_inventory_sources`|`see below`|yes|Data structure describing your inventory sources Described below. Alias: inventory_sources || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to inventory sources creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_job_templates/README.md b/roles/controller_job_templates/README.md index 6d945224f..0244e31e1 100644 --- a/roles/controller_job_templates/README.md +++ b/roles/controller_job_templates/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_templates`|`see below`|yes|Data structure describing your job template or job templates Described below. Alias: job_templates || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to job template creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_labels/README.md b/roles/controller_labels/README.md index ce6cf14a3..78f443ef9 100644 --- a/roles/controller_labels/README.md +++ b/roles/controller_labels/README.md @@ -22,6 +22,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_labels`|`see below`|yes|Data structure describing your label or labels Described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to label creation, modification, or deletion, instead of failing on the first error.|| ### Secure Logging Variables diff --git a/roles/controller_notification_templates/README.md b/roles/controller_notification_templates/README.md index ddf589dc9..3306604b1 100644 --- a/roles/controller_notification_templates/README.md +++ b/roles/controller_notification_templates/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_notifications`|`see below`|yes|Data structure describing your notification entries described below. Alias: notification_templates || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to notification template creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_project_update/README.md b/roles/controller_project_update/README.md index 548ac2329..d84e77a8e 100644 --- a/roles/controller_project_update/README.md +++ b/roles/controller_project_update/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_projects`|`see below`|yes|Data structure describing the project to update Described below. Alias: projects || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to project update, instead of failing on the first error.|| ### Secure Logging Variables diff --git a/roles/controller_projects/README.md b/roles/controller_projects/README.md index a0cbf64d2..758693078 100644 --- a/roles/controller_projects/README.md +++ b/roles/controller_projects/README.md @@ -24,6 +24,7 @@ Currently: |`controller_oauthtoken`|""|no|str|Controller Admin User's token on the Ansible Controller Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`controller_request_timeout`|`10`|no|int|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_projects`|`see below`|yes|str|Data structure describing your project or projects Described below. Alias: projects || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to project creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_roles/README.md b/roles/controller_roles/README.md index 69ae212db..5ea85225b 100644 --- a/roles/controller_roles/README.md +++ b/roles/controller_roles/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_roles`|`see below`|yes|Data structure describing your RBAC entries described below.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to RBAC entries creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_schedules/README.md b/roles/controller_schedules/README.md index c3e691b60..51927862d 100644 --- a/roles/controller_schedules/README.md +++ b/roles/controller_schedules/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_schedules`|`see below`|yes|Data structure describing your schedule or schedules Described below. Alias: schedules || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to schedule creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_teams/README.md b/roles/controller_teams/README.md index 96650cde9..231303d16 100644 --- a/roles/controller_teams/README.md +++ b/roles/controller_teams/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`aap_teams`|`see below`|yes|Data structure describing your Teams described below. Alias: teams || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to team creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_users/README.md b/roles/controller_users/README.md index 26344a3dd..ec3acfb81 100644 --- a/roles/controller_users/README.md +++ b/roles/controller_users/README.md @@ -25,6 +25,7 @@ Currently: |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`aap_user_accounts`|`see below`|yes|Data structure describing your user entries described below. Alias: users || |`controller_user_default_password`|""|no|Global variable to set the password for all users.|| +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to user creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults diff --git a/roles/controller_workflow_job_templates/README.md b/roles/controller_workflow_job_templates/README.md index ec407c14c..abf4552a2 100644 --- a/roles/controller_workflow_job_templates/README.md +++ b/roles/controller_workflow_job_templates/README.md @@ -24,6 +24,7 @@ Currently: |`aap_token`|""|no|Controller Admin User's token on the Ansible Automation Platform Server. This should be stored in an Ansible Vault at or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.|| |`aap_request_timeout`|`10`|no|Specify the timeout in seconds Ansible should use in requests to the Ansible Automation Platform host.|| |`controller_workflows`|`see below`|yes|Data structure describing your workflow job templates described below. Alias: workflow_job_templates || +|`collect_logs`|`false`|no|Specify whether it collects logs for all failed tasks related to workflow job template creation, modification, or deletion, instead of failing on the first error.|| ### Enforcing defaults From 6564695f96510501e19ac2884d3a067c8e0e9ae1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Tue, 17 Dec 2024 15:15:14 +0100 Subject: [PATCH 29/34] misc: add default for response if does not exist --- roles/controller_applications/tasks/async_application.yml | 2 +- roles/controller_bulk_host_create/tasks/async_bulk_host.yml | 2 +- .../tasks/async_credential_input.yml | 2 +- .../controller_credential_types/tasks/async_credetnial_type.yml | 2 +- roles/controller_credentials/tasks/async_credential.yaml | 2 +- .../tasks/async_execution_environment.yml | 2 +- roles/controller_host_groups/tasks/async_host_group.yml | 2 +- roles/controller_hosts/tasks/async_host.yml | 2 +- roles/controller_instance_groups/tasks/async_instance_group.yml | 2 +- roles/controller_instances/tasks/async_instance.yml | 2 +- roles/controller_inventories/tasks/async_inventory.yml | 2 +- .../tasks/async_inventory_source_update.yml | 2 +- .../tasks/async_inventory_source.yml | 2 +- roles/controller_job_templates/tasks/async_template.yml | 2 +- roles/controller_labels/tasks/async_label.yml | 2 +- .../tasks/async_notification_template.yml | 2 +- roles/controller_organizations/tasks/async_organization.yml | 2 +- roles/controller_project_update/tasks/async_project_update.yml | 2 +- roles/controller_projects/tasks/async_project.yml | 2 +- roles/controller_roles/tasks/async_role.yml | 2 +- roles/controller_schedules/tasks/async_schedule.yml | 2 +- roles/controller_teams/tasks/async_team.yml | 2 +- roles/controller_users/tasks/async_user.yml | 2 +- .../controller_workflow_job_templates/tasks/async_workflow.yml | 2 +- .../tasks/async_workflow_node.yml | 2 +- .../tasks/async_workflow_node_link.yml | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/controller_applications/tasks/async_application.yml b/roles/controller_applications/tasks/async_application.yml index 5bf7102aa..6156c406b 100644 --- a/roles/controller_applications/tasks/async_application.yml +++ b/roles/controller_applications/tasks/async_application.yml @@ -17,7 +17,7 @@ - name: async_application | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_application | Building list of not processed applications ansible.builtin.set_fact: diff --git a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml index 8697b8ed8..b1aa47ab9 100644 --- a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml +++ b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml @@ -17,7 +17,7 @@ - name: async_bulk_host | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_bulk_host | Building list of not processed bulk_hosts ansible.builtin.set_fact: diff --git a/roles/controller_credential_input_sources/tasks/async_credential_input.yml b/roles/controller_credential_input_sources/tasks/async_credential_input.yml index ec35b4e93..12c5e5681 100644 --- a/roles/controller_credential_input_sources/tasks/async_credential_input.yml +++ b/roles/controller_credential_input_sources/tasks/async_credential_input.yml @@ -17,7 +17,7 @@ - name: async_credential_input | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_credential_input | Building list of not processed bulk_hosts ansible.builtin.set_fact: diff --git a/roles/controller_credential_types/tasks/async_credetnial_type.yml b/roles/controller_credential_types/tasks/async_credetnial_type.yml index 3fff8227c..21fba5b5d 100644 --- a/roles/controller_credential_types/tasks/async_credetnial_type.yml +++ b/roles/controller_credential_types/tasks/async_credetnial_type.yml @@ -17,7 +17,7 @@ - name: async_credential_type | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_credential_type | Building list of not processed credential_types ansible.builtin.set_fact: diff --git a/roles/controller_credentials/tasks/async_credential.yaml b/roles/controller_credentials/tasks/async_credential.yaml index 81b40de3a..9f5bd4c8c 100644 --- a/roles/controller_credentials/tasks/async_credential.yaml +++ b/roles/controller_credentials/tasks/async_credential.yaml @@ -17,7 +17,7 @@ - name: async_credential | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_credential | Building list of not processed credentials ansible.builtin.set_fact: diff --git a/roles/controller_execution_environments/tasks/async_execution_environment.yml b/roles/controller_execution_environments/tasks/async_execution_environment.yml index dd878ce54..91631dd37 100644 --- a/roles/controller_execution_environments/tasks/async_execution_environment.yml +++ b/roles/controller_execution_environments/tasks/async_execution_environment.yml @@ -17,7 +17,7 @@ - name: async_execution_environment | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_execution_environment | Building list of not processed credential_types ansible.builtin.set_fact: diff --git a/roles/controller_host_groups/tasks/async_host_group.yml b/roles/controller_host_groups/tasks/async_host_group.yml index 75be2d890..e459972cb 100644 --- a/roles/controller_host_groups/tasks/async_host_group.yml +++ b/roles/controller_host_groups/tasks/async_host_group.yml @@ -17,7 +17,7 @@ - name: async_host_group | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_host_group | Building list of not processed credential_types ansible.builtin.set_fact: diff --git a/roles/controller_hosts/tasks/async_host.yml b/roles/controller_hosts/tasks/async_host.yml index b226a72d3..17e6952a2 100644 --- a/roles/controller_hosts/tasks/async_host.yml +++ b/roles/controller_hosts/tasks/async_host.yml @@ -17,7 +17,7 @@ - name: async_host | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_host | Building list of not processed hosts ansible.builtin.set_fact: diff --git a/roles/controller_instance_groups/tasks/async_instance_group.yml b/roles/controller_instance_groups/tasks/async_instance_group.yml index f234a0ff1..e91ac40d3 100644 --- a/roles/controller_instance_groups/tasks/async_instance_group.yml +++ b/roles/controller_instance_groups/tasks/async_instance_group.yml @@ -17,7 +17,7 @@ - name: async_instance_group | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_instance_group | Building list of not processed hosts ansible.builtin.set_fact: diff --git a/roles/controller_instances/tasks/async_instance.yml b/roles/controller_instances/tasks/async_instance.yml index d44435b39..5bc57dc64 100644 --- a/roles/controller_instances/tasks/async_instance.yml +++ b/roles/controller_instances/tasks/async_instance.yml @@ -17,7 +17,7 @@ - name: async_instance | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_instance | Building list of not processed hosts ansible.builtin.set_fact: diff --git a/roles/controller_inventories/tasks/async_inventory.yml b/roles/controller_inventories/tasks/async_inventory.yml index 03c390896..e818b2f98 100644 --- a/roles/controller_inventories/tasks/async_inventory.yml +++ b/roles/controller_inventories/tasks/async_inventory.yml @@ -17,7 +17,7 @@ - name: async_inventory | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_inventory | Building list of not processed inventories ansible.builtin.set_fact: diff --git a/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml index f01badd0c..445518550 100644 --- a/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml +++ b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml @@ -17,7 +17,7 @@ - name: async_inventory_source_update | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_inventory_source_update | Building list of not processed inventories ansible.builtin.set_fact: diff --git a/roles/controller_inventory_sources/tasks/async_inventory_source.yml b/roles/controller_inventory_sources/tasks/async_inventory_source.yml index 574dfa440..b05eef3de 100644 --- a/roles/controller_inventory_sources/tasks/async_inventory_source.yml +++ b/roles/controller_inventory_sources/tasks/async_inventory_source.yml @@ -17,7 +17,7 @@ - name: async_inventory_source | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_inventory_source | Building list of not processed inventory_sources ansible.builtin.set_fact: diff --git a/roles/controller_job_templates/tasks/async_template.yml b/roles/controller_job_templates/tasks/async_template.yml index a8d4f9c99..791d2d892 100644 --- a/roles/controller_job_templates/tasks/async_template.yml +++ b/roles/controller_job_templates/tasks/async_template.yml @@ -23,7 +23,7 @@ - name: async_template | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_template | Building list of not processed templates ansible.builtin.set_fact: diff --git a/roles/controller_labels/tasks/async_label.yml b/roles/controller_labels/tasks/async_label.yml index 66fb544ce..2c00675c5 100644 --- a/roles/controller_labels/tasks/async_label.yml +++ b/roles/controller_labels/tasks/async_label.yml @@ -17,7 +17,7 @@ - name: async_label | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_label | Building list of not processed labels ansible.builtin.set_fact: diff --git a/roles/controller_notification_templates/tasks/async_notification_template.yml b/roles/controller_notification_templates/tasks/async_notification_template.yml index fb9fbfcc6..40bf3d711 100644 --- a/roles/controller_notification_templates/tasks/async_notification_template.yml +++ b/roles/controller_notification_templates/tasks/async_notification_template.yml @@ -19,7 +19,7 @@ - name: async_notification_template | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_notification_template | Building list of not processed templates ansible.builtin.set_fact: diff --git a/roles/controller_organizations/tasks/async_organization.yml b/roles/controller_organizations/tasks/async_organization.yml index 27a7b9fce..fb5787431 100644 --- a/roles/controller_organizations/tasks/async_organization.yml +++ b/roles/controller_organizations/tasks/async_organization.yml @@ -19,7 +19,7 @@ - name: async_organization | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_organization | Building list of not processed templates ansible.builtin.set_fact: diff --git a/roles/controller_project_update/tasks/async_project_update.yml b/roles/controller_project_update/tasks/async_project_update.yml index 39f16e3dc..629bfb783 100644 --- a/roles/controller_project_update/tasks/async_project_update.yml +++ b/roles/controller_project_update/tasks/async_project_update.yml @@ -17,7 +17,7 @@ - name: async_project_update | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_project_update | Building list of not processed projects ansible.builtin.set_fact: diff --git a/roles/controller_projects/tasks/async_project.yml b/roles/controller_projects/tasks/async_project.yml index 9ca242a03..59f5fec22 100644 --- a/roles/controller_projects/tasks/async_project.yml +++ b/roles/controller_projects/tasks/async_project.yml @@ -17,7 +17,7 @@ - name: async_project | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_project | Building list of not processed projects ansible.builtin.set_fact: diff --git a/roles/controller_roles/tasks/async_role.yml b/roles/controller_roles/tasks/async_role.yml index d3059ab24..a03f597c1 100644 --- a/roles/controller_roles/tasks/async_role.yml +++ b/roles/controller_roles/tasks/async_role.yml @@ -17,7 +17,7 @@ - name: async_role | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_role | Building list of not processed roles ansible.builtin.set_fact: diff --git a/roles/controller_schedules/tasks/async_schedule.yml b/roles/controller_schedules/tasks/async_schedule.yml index cd9ef705f..59fd69928 100644 --- a/roles/controller_schedules/tasks/async_schedule.yml +++ b/roles/controller_schedules/tasks/async_schedule.yml @@ -17,7 +17,7 @@ - name: async_schedule | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_schedule | Building list of not processed schedules ansible.builtin.set_fact: diff --git a/roles/controller_teams/tasks/async_team.yml b/roles/controller_teams/tasks/async_team.yml index 60dfc304b..510652d21 100644 --- a/roles/controller_teams/tasks/async_team.yml +++ b/roles/controller_teams/tasks/async_team.yml @@ -17,7 +17,7 @@ - name: async_team | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_team | Building list of not processed teams ansible.builtin.set_fact: diff --git a/roles/controller_users/tasks/async_user.yml b/roles/controller_users/tasks/async_user.yml index 0b8bf3404..9fd2c3dd0 100644 --- a/roles/controller_users/tasks/async_user.yml +++ b/roles/controller_users/tasks/async_user.yml @@ -17,7 +17,7 @@ - name: async_user | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_user | Building list of not processed users ansible.builtin.set_fact: diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow.yml b/roles/controller_workflow_job_templates/tasks/async_workflow.yml index 2a5ccd341..8b3edf48e 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow.yml @@ -18,7 +18,7 @@ - name: async_workflow | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_workflow | Building list of not processed workflows ansible.builtin.set_fact: diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml index 4996d3fe2..fcbeac0b3 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml @@ -17,7 +17,7 @@ - name: async_workflow_node | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_workflow_node | Building list of not processed nodes ansible.builtin.set_fact: diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml index 6113d1757..068bd7618 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml @@ -18,7 +18,7 @@ - name: async_workflow_node_link | Show error and stop execution when: not collect_logs ansible.builtin.fail: - msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] }}" + msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - name: async_workflow_node_link | Building list of not processed links ansible.builtin.set_fact: From 87923c89859f002c3742a11d5678efcedb108e28 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Wed, 18 Dec 2024 11:51:28 +0100 Subject: [PATCH 30/34] misc: tweak error list --- roles/controller_roles/tasks/async_role.yml | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/roles/controller_roles/tasks/async_role.yml b/roles/controller_roles/tasks/async_role.yml index a03f597c1..8cf87793c 100644 --- a/roles/controller_roles/tasks/async_role.yml +++ b/roles/controller_roles/tasks/async_role.yml @@ -23,7 +23,27 @@ ansible.builtin.set_fact: __roles_error_list: "{{ __roles_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'role': __error_data['invocation']['module_args']['role'] | default(''), + 'user': __error_data['invocation']['module_args']['user'] | default(''), + 'users': __error_data['invocation']['module_args']['users'] | default(''), + 'team': __error_data['invocation']['module_args']['team'] | default(''), + 'teams': __error_data['invocation']['module_args']['teams'] | default(''), + 'target_team': __error_data['invocation']['module_args']['target_team'] | default(''), + 'target_teams': __error_data['invocation']['module_args']['target_teams'] | default(''), + 'inventory': __error_data['invocation']['module_args']['inventory'] | default(''), + 'inventories': __error_data['invocation']['module_args']['inventories'] | default(''), + 'job_template': __error_data['invocation']['module_args']['job_template'] | default(''), + 'job_templates': __error_data['invocation']['module_args']['job_templates'] | default(''), + 'workflow': __error_data['invocation']['module_args']['workflow'] | default(''), + 'workflows': __error_data['invocation']['module_args']['workflows'] | default(''), + 'credential': __error_data['invocation']['module_args']['credential'] | default(''), + 'credentials': __error_data['invocation']['module_args']['credentials'] | default(''), + 'organization': __error_data['invocation']['module_args']['organization'] | default(''), + 'organizations': __error_data['invocation']['module_args']['organizations'] | default(''), + 'lookup_organization': __error_data['invocation']['module_args']['lookup_organization'] | default(''), + 'project': __error_data['invocation']['module_args']['project'] | default(''), + 'projects': __error_data['invocation']['module_args']['projects'] | default(''), + 'instance_groups': __error_data['invocation']['module_args']['instance_groups'] | default(''), 'error': __error_data['msg'] | default('') } ] From 33d1db7d1dbc55e3985f46e500e0025bbdad3c9c Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Wed, 18 Dec 2024 14:02:43 +0100 Subject: [PATCH 31/34] misc: tweaks and polish the code --- .../tasks/async_application.yml | 2 +- .../tasks/async_bulk_host.yml | 2 +- .../tasks/async_credential_input.yml | 2 +- .../tasks/async_execution_environment.yml | 16 ++++++++-------- .../tasks/async_instance_group.yml | 16 ++++++++-------- .../tasks/async_instance.yml | 14 +++++++------- .../tasks/async_inventory_source_update.yml | 16 +++++++++------- .../tasks/async_inventory_source.yml | 10 ++++++---- .../tasks/async_template.yml | 10 +++++----- .../tasks/async_project_update.yml | 15 ++++++++------- .../controller_projects/tasks/async_project.yml | 1 + roles/controller_users/tasks/async_user.yml | 2 +- .../tasks/async_workflow.yml | 2 +- .../tasks/async_workflow_node.yml | 5 +++-- .../tasks/async_workflow_node_link.yml | 3 ++- 15 files changed, 62 insertions(+), 54 deletions(-) diff --git a/roles/controller_applications/tasks/async_application.yml b/roles/controller_applications/tasks/async_application.yml index 6156c406b..6a457896c 100644 --- a/roles/controller_applications/tasks/async_application.yml +++ b/roles/controller_applications/tasks/async_application.yml @@ -3,7 +3,7 @@ block: - name: async_application | Managing Controller Applications | Wait for finish the applications management ansible.builtin.async_status: - jid: "{{ __applications_job_async_result_item.ansible_job_id }}" + jid: "{{ __applications_job_async_results_item.ansible_job_id }}" register: __applications_job_async_result until: __applications_job_async_result.finished retries: "{{ controller_configuration_applications_async_retries }}" diff --git a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml index b1aa47ab9..e6427912f 100644 --- a/roles/controller_bulk_host_create/tasks/async_bulk_host.yml +++ b/roles/controller_bulk_host_create/tasks/async_bulk_host.yml @@ -23,7 +23,7 @@ ansible.builtin.set_fact: __bulk_hosts_error_list: "{{ __bulk_hosts_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'hosts': __error_data['invocation']['module_args']['hosts'] | default(''), 'error': __error_data['msg'] | default('') } ] diff --git a/roles/controller_credential_input_sources/tasks/async_credential_input.yml b/roles/controller_credential_input_sources/tasks/async_credential_input.yml index 12c5e5681..807be872f 100644 --- a/roles/controller_credential_input_sources/tasks/async_credential_input.yml +++ b/roles/controller_credential_input_sources/tasks/async_credential_input.yml @@ -23,7 +23,7 @@ ansible.builtin.set_fact: __credential_inputs_error_list: "{{ __credential_inputs_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'input_field_name': __error_data['invocation']['module_args']['input_field_name'] | default(''), 'error': __error_data['msg'] | default('') } ] diff --git a/roles/controller_execution_environments/tasks/async_execution_environment.yml b/roles/controller_execution_environments/tasks/async_execution_environment.yml index 91631dd37..afde8cef1 100644 --- a/roles/controller_execution_environments/tasks/async_execution_environment.yml +++ b/roles/controller_execution_environments/tasks/async_execution_environment.yml @@ -3,7 +3,7 @@ block: - name: async_execution_environment | Managing Controller Execution Environments | Wait for finish the credential_types management ansible.builtin.async_status: - jid: "{{ __execution_environments_job_async_result_item.ansible_job_id }}" + jid: "{{ __execution_environments_job_async_results_item.ansible_job_id }}" register: __execution_environments_job_async_result until: __execution_environments_job_async_result.finished retries: "{{ controller_configuration_execution_environments_async_retries }}" @@ -21,11 +21,11 @@ - name: async_execution_environment | Building list of not processed credential_types ansible.builtin.set_fact: - __execution_environment_error_list: "{{ __execution_environment_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] - }}" + __execution_environments_error_list: "{{ __execution_environments_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" ... diff --git a/roles/controller_instance_groups/tasks/async_instance_group.yml b/roles/controller_instance_groups/tasks/async_instance_group.yml index e91ac40d3..a36254369 100644 --- a/roles/controller_instance_groups/tasks/async_instance_group.yml +++ b/roles/controller_instance_groups/tasks/async_instance_group.yml @@ -11,7 +11,7 @@ rescue: - name: async_instance_group | Load error details ansible.builtin.include_vars: - file: "{{ __host_job_async_result.results_file }}" + file: "{{ __instance_groups_job_async_result.results_file }}" name: __error_data - name: async_instance_group | Show error and stop execution @@ -21,11 +21,11 @@ - name: async_instance_group | Building list of not processed hosts ansible.builtin.set_fact: - __instance_group_error_list: "{{ __instance_group_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] - }}" + __instance_groups_error_list: "{{ __instance_group_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" ... diff --git a/roles/controller_instances/tasks/async_instance.yml b/roles/controller_instances/tasks/async_instance.yml index 5bc57dc64..4da818490 100644 --- a/roles/controller_instances/tasks/async_instance.yml +++ b/roles/controller_instances/tasks/async_instance.yml @@ -21,11 +21,11 @@ - name: async_instance | Building list of not processed hosts ansible.builtin.set_fact: - __instance_error_list: "{{ __instance_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] - }}" + __instances_error_list: "{{ __instances_error_list | default([]) + [ + { + 'hostname': __error_data['invocation']['module_args']['hostname'] | default(''), + 'error': __error_data['msg'] | default('') + } + ] + }}" ... diff --git a/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml index 445518550..a831be852 100644 --- a/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml +++ b/roles/controller_inventory_source_update/tasks/async_inventory_source_update.yml @@ -21,11 +21,13 @@ - name: async_inventory_source_update | Building list of not processed inventories ansible.builtin.set_fact: - __inventory_source_update_error_list: "{{ __inventory_source_update_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] - }}" + __inventory_sources_error_list: "{{ __inventory_source_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'inventory': __error_data['invocation']['module_args']['inventory'] | default(''), + 'type': 'update issue', + 'error': __error_data['msg'] | default('') + } + ] + }}" ... diff --git a/roles/controller_inventory_sources/tasks/async_inventory_source.yml b/roles/controller_inventory_sources/tasks/async_inventory_source.yml index b05eef3de..e395dcb5c 100644 --- a/roles/controller_inventory_sources/tasks/async_inventory_source.yml +++ b/roles/controller_inventory_sources/tasks/async_inventory_source.yml @@ -19,13 +19,15 @@ ansible.builtin.fail: msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - - name: async_inventory_source | Building list of not processed inventory_sources + - name: async_inventory_source | Building list of not processed inventories ansible.builtin.set_fact: - __inventory_sources_error_list: "{{ __inventory_sources_error_list | default([]) + [ - { + __inventory_sources_error_list: "{{ __inventory_source_error_list | default([]) + [ + { 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'inventory': __error_data['invocation']['module_args']['inventory'] | default(''), + 'type': 'create issue', 'error': __error_data['msg'] | default('') - } + } ] }}" ... diff --git a/roles/controller_job_templates/tasks/async_template.yml b/roles/controller_job_templates/tasks/async_template.yml index 791d2d892..f1e223654 100644 --- a/roles/controller_job_templates/tasks/async_template.yml +++ b/roles/controller_job_templates/tasks/async_template.yml @@ -2,12 +2,12 @@ - name: async_template | An async_template block block: - name: async_template | Managing Controller Job Templates | Wait for finish the Job Templates management - ansible.builtin.async_template_status: + 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_template_retries }}" - delay: "{{ controller_configuration_job_templates_async_template_delay }}" + retries: "{{ controller_configuration_job_templates_async_retries }}" + delay: "{{ controller_configuration_job_templates_async_delay }}" rescue: - name: async_template | Removing variables existance from result_file ansible.builtin.replace: @@ -35,8 +35,8 @@ 'inventory': __error_data['invocation']['module_args']['inventory'], 'credentials': __error_data['invocation']['module_args']['credentials'], 'error': __error_data['msg'], - 'response': __error_data['response'] + 'response': __error_data['response'] | default('N/A') } - ] + ] }}" ... diff --git a/roles/controller_project_update/tasks/async_project_update.yml b/roles/controller_project_update/tasks/async_project_update.yml index 629bfb783..33b7a227c 100644 --- a/roles/controller_project_update/tasks/async_project_update.yml +++ b/roles/controller_project_update/tasks/async_project_update.yml @@ -21,11 +21,12 @@ - name: async_project_update | Building list of not processed projects ansible.builtin.set_fact: - __project_updates_error_list: "{{ __project_updates_error_list | default([]) + [ - { - 'name': __error_data['invocation']['module_args']['name'] | default(''), - 'error': __error_data['msg'] | default('') - } - ] - }}" + __projects_error_list: "{{ __projects_error_list | default([]) + [ + { + 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'type': 'update issue', + 'error': __error_data['msg'] | default('') + } + ] + }}" ... diff --git a/roles/controller_projects/tasks/async_project.yml b/roles/controller_projects/tasks/async_project.yml index 59f5fec22..c3e41fdf8 100644 --- a/roles/controller_projects/tasks/async_project.yml +++ b/roles/controller_projects/tasks/async_project.yml @@ -24,6 +24,7 @@ __projects_error_list: "{{ __projects_error_list | default([]) + [ { 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'type': 'create issue', 'error': __error_data['msg'] | default('') } ] diff --git a/roles/controller_users/tasks/async_user.yml b/roles/controller_users/tasks/async_user.yml index 9fd2c3dd0..3490e6be0 100644 --- a/roles/controller_users/tasks/async_user.yml +++ b/roles/controller_users/tasks/async_user.yml @@ -23,7 +23,7 @@ ansible.builtin.set_fact: __users_error_list: "{{ __users_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default(''), + 'name': __error_data['invocation']['module_args']['username'] | default(''), 'error': __error_data['msg'] | default('') } ] diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow.yml b/roles/controller_workflow_job_templates/tasks/async_workflow.yml index 8b3edf48e..879b3ce3a 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow.yml @@ -24,7 +24,7 @@ ansible.builtin.set_fact: __workflows_error_list: "{{ __workflows_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), + 'name': __error_data['invocation']['module_args']['name'] | default (''), 'error': __error_data['msg'] | default(__workflows_job_async_result['msg']) } ] diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml index fcbeac0b3..f7aeb15cb 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node.yml @@ -23,8 +23,9 @@ ansible.builtin.set_fact: __workflow_nodes_error_list: "{{ __workflow_nodes_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), - 'type': 'node creation', + 'name': __error_data['invocation']['module_args']['unified_job_template'] | default ('N/A'), + 'workflow': __error_data['invocation']['module_args']['workflow'] | default ('N/A'), + 'type': 'node creation issue', 'error': __error_data['msg'] | default(__workflows_node_async_result['msg']) } ] diff --git a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml index 068bd7618..b42df2002 100644 --- a/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml +++ b/roles/controller_workflow_job_templates/tasks/async_workflow_node_link.yml @@ -24,7 +24,8 @@ ansible.builtin.set_fact: __workflow_nodes_error_list: "{{ workflow_nodes_error_list | default([]) + [ { - 'name': __error_data['invocation']['module_args']['name'] | default ('N/A'), + 'name': __error_data['invocation']['module_args']['identifier'] | default (''), + 'workflow': __error_data['invocation']['module_args']['workflow'] | default (''), 'type': 'link issue', 'error': __error_data['msg'] | default(__workflows_link_async_result['msg']) } From 7c3ae7e3bdfa5151312754ad7e6dcfb502da1fba Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Wed, 18 Dec 2024 14:07:12 +0100 Subject: [PATCH 32/34] fix: missing changelog --- changelogs/fragments/controller_objects.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/controller_objects.yml diff --git a/changelogs/fragments/controller_objects.yml b/changelogs/fragments/controller_objects.yml new file mode 100644 index 000000000..5e85d08e2 --- /dev/null +++ b/changelogs/fragments/controller_objects.yml @@ -0,0 +1,3 @@ +--- +minor_change: + - Add the ability to collect error logs while importing the object, instead of failing on the first error. From a8c9a9d43fbc2f9a799d41e0dde9c70df929528c Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Wed, 18 Dec 2024 14:17:05 +0100 Subject: [PATCH 33/34] fix: typos --- ...c_credetnial_type.yml => async_credential_type.yml} | 0 .../{async_credential.yaml => async_credential.yml} | 0 roles/controller_inventory_sources/tasks/main.yml | 2 +- .../tasks/async_notification_template.yml | 10 +++++----- 4 files changed, 6 insertions(+), 6 deletions(-) rename roles/controller_credential_types/tasks/{async_credetnial_type.yml => async_credential_type.yml} (100%) rename roles/controller_credentials/tasks/{async_credential.yaml => async_credential.yml} (100%) diff --git a/roles/controller_credential_types/tasks/async_credetnial_type.yml b/roles/controller_credential_types/tasks/async_credential_type.yml similarity index 100% rename from roles/controller_credential_types/tasks/async_credetnial_type.yml rename to roles/controller_credential_types/tasks/async_credential_type.yml diff --git a/roles/controller_credentials/tasks/async_credential.yaml b/roles/controller_credentials/tasks/async_credential.yml similarity index 100% rename from roles/controller_credentials/tasks/async_credential.yaml rename to roles/controller_credentials/tasks/async_credential.yml diff --git a/roles/controller_inventory_sources/tasks/main.yml b/roles/controller_inventory_sources/tasks/main.yml index 33723c7a2..023be1a41 100644 --- a/roles/controller_inventory_sources/tasks/main.yml +++ b/roles/controller_inventory_sources/tasks/main.yml @@ -57,7 +57,7 @@ when: ansible_check_mode and __inventory_source_job_async.failed is defined and __inventory_source_job_async.failed - name: Managing Inventory Sources | Wait for finish the Inventory Sources management - ansible.builtin.include_tasks: async_inventory_sources.yml + ansible.builtin.include_tasks: async_inventory_source.yml loop: "{{ __inventory_source_job_async.results }}" loop_control: loop_var: __inventory_source_job_async_results_item diff --git a/roles/controller_notification_templates/tasks/async_notification_template.yml b/roles/controller_notification_templates/tasks/async_notification_template.yml index 40bf3d711..d850ea03e 100644 --- a/roles/controller_notification_templates/tasks/async_notification_template.yml +++ b/roles/controller_notification_templates/tasks/async_notification_template.yml @@ -1,7 +1,7 @@ --- -- name: async_notification_template | An async_notification_template block +- name: async_notification_template | An async_notification_template block block: - - name: async_notification_template | Managing Controller Notification Templates | Wait for finish the Job Templates management + - name: async_notification_template | Managing Controller Notification Templates | Wait for finish the Job Templates management ansible.builtin.async_status: jid: "{{ __controller_notification_job_async_results_item.ansible_job_id }}" register: __controller_notification_job_async_result @@ -11,17 +11,17 @@ rescue: - - name: async_notification_template | Load error details + - name: async_notification_template | Load error details ansible.builtin.include_vars: file: "{{ __controller_notification_job_async_result.results_file }}" name: __error_data - - name: async_notification_template | Show error and stop execution + - name: async_notification_template | Show error and stop execution when: not collect_logs ansible.builtin.fail: msg: "error: {{ __error_data['msg'] }}, response: {{ __error_data['response'] | default ('N/A') }}" - - name: async_notification_template | Building list of not processed templates + - name: async_notification_template | Building list of not processed templates ansible.builtin.set_fact: __notification_templates_error_list: "{{ __notification_templates_error_list | default([]) + [ { From a7272ceea4117014cc83fe3474a78c6d8abf5f43 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kalitowski Date: Wed, 18 Dec 2024 15:18:16 +0100 Subject: [PATCH 34/34] fix: typo in changelog --- changelogs/fragments/controller_objects.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/controller_objects.yml b/changelogs/fragments/controller_objects.yml index 5e85d08e2..1d3287a37 100644 --- a/changelogs/fragments/controller_objects.yml +++ b/changelogs/fragments/controller_objects.yml @@ -1,3 +1,3 @@ --- -minor_change: +minor_changes: - Add the ability to collect error logs while importing the object, instead of failing on the first error.