Skip to content

Commit

Permalink
Fix changed_when statement in all roles to show correct state and dis… (
Browse files Browse the repository at this point in the history
redhat-cop#815)

* Fix changed_when statement in all roles to show correct state and display diff output

* Create check_state.yml

---------

Co-authored-by: Tom Page <[email protected]>
Co-authored-by: Tom Page <[email protected]>
  • Loading branch information
3 people authored and Przemyslaw Kalitowski committed Nov 22, 2024
1 parent e2b21a1 commit 48c3d2f
Show file tree
Hide file tree
Showing 25 changed files with 28 additions and 24 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/check_state.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- Fix changed_when statement in all roles to show correct state
...
2 changes: 1 addition & 1 deletion roles/applications/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __applications_job_async
changed_when: not __applications_job_async.changed
changed_when: "(__applications_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__application_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/bulk_host_create/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_bulk_hosts_job_async
changed_when: not __controller_bulk_hosts_job_async.changed
changed_when: "(__controller_bulk_hosts_job_async.changed if ansible_check_mode else false)"
vars:
ansible_async_dir: '{{ controller_configuration_async_dir }}'

Expand Down
2 changes: 1 addition & 1 deletion roles/credential_input_sources/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __credential_input_sources_job_async
changed_when: not __credential_input_sources_job_async.changed
changed_when: "(__credential_input_sources_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__cred_input_src_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/credential_types/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __credentialtypes_job_async
changed_when: not __credentialtypes_job_async.changed
changed_when: "(__credentialtypes_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_credential_type_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/credentials/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __credentials_job_async
changed_when: not __credentials_job_async.changed
changed_when: "(__credentials_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_credentials_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/execution_environments/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __execution_environments_job_async
changed_when: not __execution_environments_job_async.changed
changed_when: "(__execution_environments_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__execution_environments_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/groups/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __group_job_async
changed_when: not __group_job_async.changed
changed_when: "(__group_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_groups_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/hosts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __host_job_async
changed_when: not __host_job_async.changed
changed_when: "(__host_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_host_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/instance_groups/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __instance_groups_job_async
changed_when: not __instance_groups_job_async.changed
changed_when: "(__instance_groups_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_instance_group_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/instances/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __instance_job_async
changed_when: not __instance_job_async.changed
changed_when: "(__instance_job_async.changed if ansible_check_mode else false)"
vars:
ansible_async_dir: '{{ controller_configuration_async_dir }}'

Expand Down
2 changes: 1 addition & 1 deletion roles/inventories/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __inventories_job_async
changed_when: not __inventories_job_async.changed
changed_when: "(__inventories_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_inventory_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/inventory_sources/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __inventory_source_job_async
changed_when: not __inventory_source_job_async.changed
changed_when: "(__inventory_source_job_async.changed if ansible_check_mode else false)"
when: (__controller_source_item.source | default(('scm' if controller_configuration_inventory_sources_enforce_defaults else omit), true)) != "constructed"
vars:
__operation: "{{ operation_translate[__controller_source_item.state | default(controller_state) | default('present')] }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/job_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __job_templates_job_async
changed_when: not __job_templates_job_async.changed
changed_when: "(__job_templates_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_template_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/labels/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_label_job_async
changed_when: not __controller_label_job_async.changed
changed_when: "(__controller_label_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_label_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/notification_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_notification_job_async
changed_when: not __controller_notification_job_async.changed
changed_when: "(__controller_notification_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_notification_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/organizations/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __organizations_job_async
changed_when: not __organizations_job_async.changed
changed_when: "(__organizations_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_organizations_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/project_update/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __project_update_job_async
changed_when: not __project_update_job_async.changed
changed_when: "(__project_update_job_async.changed if ansible_check_mode else false)"
vars:
ansible_async_dir: '{{ controller_configuration_async_dir }}'

Expand Down
2 changes: 1 addition & 1 deletion roles/projects/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __projects_job_async
changed_when: not __projects_job_async.changed
changed_when: "(__projects_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_project_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/roles/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_role_job_async
changed_when: not __controller_role_job_async.changed
changed_when: "(__controller_role_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_role_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/schedules/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_schedule_job_async
changed_when: not __controller_schedule_job_async.changed
changed_when: "(__controller_schedule_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_schedule_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/settings/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_setting_job_async
changed_when: not __controller_setting_job_async.changed
changed_when: "(__controller_setting_job_async.changed if ansible_check_mode else false)"
vars:
ansible_async_dir: '{{ controller_configuration_async_dir }}'

Expand Down
2 changes: 1 addition & 1 deletion roles/teams/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_team_job_async
changed_when: not __controller_team_job_async.changed
changed_when: "(__controller_team_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_team_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/users/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __controller_user_accounts_job_async
changed_when: not __controller_user_accounts_job_async.changed
changed_when: "(__controller_user_accounts_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__controller_user_accounts_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/workflow_job_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
async: "{{ ansible_check_mode | ternary(0, 1000) }}"
poll: 0
register: __workflows_job_async
changed_when: not __workflows_job_async.changed
changed_when: "(__workflows_job_async.changed if ansible_check_mode else false)"
vars:
__operation: "{{ operation_translate[__workflow_loop_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down

0 comments on commit 48c3d2f

Please sign in to comment.