Skip to content

Commit 1b5c4f3

Browse files
authored
Merge pull request #478 from automationiberia/issue446
add no_log everywhere controller_api_plugin is used
2 parents 094a643 + 24cabc3 commit 1b5c4f3

35 files changed

+70
-3
lines changed

changelogs/fragments/filetree_create.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ minor_changes:
33
- Renamed variable controller_workflow_job_templates to controller_workflows (the previos one was not used at all).
44
- Improve template to export settings with filetree_create role. Settings will be in yaml format.
55
- Add or fix some variables or extra_vars exported from objects like notifications, inventory, inventory_source, hosts, groups, jt or wjt.
6+
- Add no_log everywhere controller_api_plugin is used to avoid to expose sensitive information in case of crashes.
67
...

changelogs/fragments/object_diff.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
minor_changes:
3+
- Add no_log everywhere controller_api_plugin is used to avoid to expose sensitive information in case of crashes.
4+
...

roles/filetree_create/tasks/all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
is_aap: "{{ lookup(controller_api_plugin, 'ping',
55
host=controller_hostname, oauth_token=controller_oauthtoken,
66
verify_ssl=controller_validate_certs).version is version('4.0.0', '>=') }}"
7+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
78

89
- name: Include tasks (block)
910
when: "['all', 'labels', 'applications', 'instance_groups', 'settings', 'inventory', 'credentials', 'credential_types', 'notification_templates', 'users', 'teams', 'organizations', 'projects', 'execution_environments', 'job_templates', 'workflow_job_templates', 'workflow_job_template_nodes'] | intersect(input_tag) | length > 0"

roles/filetree_create/tasks/applications.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
query_params={'order_by': 'organization,id'},
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
8-
}}"
8+
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/applications output directory for applications in {{ output_path }}"
1112
ansible.builtin.file:

roles/filetree_create/tasks/credential_types.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910
when: is_aap
1011

1112
- name: "Get current Credential Types from the API when Tower"
@@ -15,6 +16,7 @@
1516
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1617
return_all=true, max_objects=query_controller_api_max_objects)
1718
}}"
19+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
1820
when: not is_aap
1921

2022
- name: "Create the output directory for credential types: {{ output_path }}"

roles/filetree_create/tasks/credentials.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/credentials output directory for credentials in {{ output_path }}"
1112
ansible.builtin.file:

roles/filetree_create/tasks/execution_environments.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the output directory for execution environments: {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/instance_groups.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the output directory for instance groups: {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/inventory.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/inventories output directory for inventories in {{ output_path }}"
1112
ansible.builtin.file:
@@ -50,6 +51,7 @@
5051
loop_control:
5152
loop_var: current_inventory_sources
5253
label: "{{ inventory_sources_output_path }}"
54+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
5355

5456
- name: "Set the inventory's hosts"
5557
ansible.builtin.include_tasks: "hosts.yml"
@@ -66,6 +68,7 @@
6668
loop_control:
6769
loop_var: current_inventory_hosts
6870
label: "{{ hosts_output_path }}"
71+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
6972

7073
- name: "Set the inventory's groups"
7174
ansible.builtin.include_tasks: "groups.yml"
@@ -82,4 +85,5 @@
8285
loop_control:
8386
loop_var: current_inventory_groups
8487
label: "{{ groups_output_path }}"
88+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
8589
...

roles/filetree_create/tasks/job_templates.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME> output directories for job templates in {{ output_path }}"
1112
ansible.builtin.file:
@@ -47,4 +48,5 @@
4748
loop_control:
4849
loop_var: current_job_templates_asset_value
4950
label: "{{ __dest }}"
51+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
5052
...

roles/filetree_create/tasks/labels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/labels output directory for labels in {{ output_path }}"
1112
ansible.builtin.file:

roles/filetree_create/tasks/notification_templates.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the <ORGANIZATION_NAME>/notification_templates output directory for notification templates in {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/organizations.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the output directory for organizations: {{ output_path + '/' + current_organization_dir.name }}"
1112
ansible.builtin.file:
@@ -42,4 +43,5 @@
4243
loop_control:
4344
loop_var: current_organization
4445
label: "{{ __dest }}"
46+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
4547
...

roles/filetree_create/tasks/projects.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/projects output directory for projects in {{ output_path }}"
1112
ansible.builtin.file:
@@ -44,4 +45,5 @@
4445
loop_control:
4546
loop_var: current_projects_asset_value
4647
label: "{{ __dest }}"
48+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
4749
...

roles/filetree_create/tasks/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the output directory for credential types: {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/team_roles.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the output directory for team roles: {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/teams.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/teams output directory for teams in {{ output_path }}"
1112
ansible.builtin.file:

roles/filetree_create/tasks/user_roles.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Create the output directory for user roles: {{ output_path }}"
1011
ansible.builtin.file:

roles/filetree_create/tasks/users.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
66
return_all=true, max_objects=query_controller_api_max_objects)
77
}}"
8+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
89

910
- name: "Add the users the Organizations information"
1011
ansible.builtin.set_fact:
1112
current_users: "{{ (current_users | default([])) + [user_lookvar_item | combine({'organizations': user_lookvar_item_organizations})] }}"
1213
vars:
13-
user_lookvar_item_organizations: "{{ query(controller_api_plugin, user_lookvar_item.related.organizations, host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs, return_all=true, max_objects=query_controller_api_max_objects) | selectattr('name', 'defined') | map(attribute='name') }}"
14+
user_lookvar_item_organizations: "{{ query(controller_api_plugin, user_lookvar_item.related.organizations,
15+
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
16+
return_all=true, max_objects=query_controller_api_max_objects
17+
) | selectattr('name', 'defined') | map(attribute='name')
18+
}}"
1419
loop: "{{ users_lookvar }}"
1520
loop_control:
1621
loop_var: user_lookvar_item
1722
label: "User {{ user_lookvar_item.username }}"
23+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
1824

1925
- name: "Create the <ORGANIZATION_NAME> output directory for users in {{ output_path }}"
2026
ansible.builtin.file:

roles/filetree_create/tasks/workflow_job_templates.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
77
return_all=true, max_objects=query_controller_api_max_objects)
88
}}"
9+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
910

1011
- name: "Create the <ORGANIZATION_NAME>/workflow_job_templates output directory for workflow job templates in {{ output_path }}"
1112
ansible.builtin.file:
@@ -50,4 +51,5 @@
5051
loop_control:
5152
loop_var: current_workflow_job_templates_asset_value
5253
label: "{{ __dest }}"
54+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
5355
...

roles/filetree_create/tests/filetree_create.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
ansible.builtin.set_fact:
2727
controller_oauthtoken: "{{ authtoken_res.json.token }}"
2828
controller_oauthtoken_url: "{{ authtoken_res.json.url }}"
29-
no_log: "{{ controller_configuration_filetree_create_secure_logging | default('false') }}"
29+
no_log: "{{ controller_configuration_filetree_create_secure_logging }}"
3030
when: controller_oauthtoken is not defined
3131
tags:
3232
- always

roles/object_diff/tasks/credential_types.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
88
return_all=true, max_objects=query_controller_api_max_objects)
99
}}"
10+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1011
when: is_aap
1112

1213
- name: "Get the API list of all Credential Types"
@@ -16,6 +17,7 @@
1617
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1718
return_all=true, max_objects=query_controller_api_max_objects)
1819
}}"
20+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1921
when: not is_aap
2022

2123
- name: "Find the difference of Credential Types between what is on the Controller versus CasC on SCM"

roles/object_diff/tasks/credentials.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
query_params={'name': orgs},
77
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)
88
}}"
9+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
910

1011
- name: "Get the API list of all Credentials in Organization {{ orgs }}"
1112
ansible.builtin.set_fact:
@@ -14,6 +15,7 @@
1415
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1516
return_all=true, max_objects=query_controller_api_max_objects)
1617
}}"
18+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1719

1820
- name: "Find the difference of Credentials between what is on the Controller versus CasC on SCM"
1921
ansible.builtin.set_fact:

roles/object_diff/tasks/groups.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
query_params={'name': orgs},
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)
77
}}"
8+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
89

910
- name: "Get the API list of all inventories"
1011
ansible.builtin.set_fact:
@@ -16,6 +17,7 @@
1617
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1718
return_all=true, max_objects=query_controller_api_max_objects)
1819
}}"
20+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1921

2022
- name: "Get the API list of all groups in the inventories at organization {{ orgs }}"
2123
ansible.builtin.set_fact:
@@ -27,6 +29,7 @@
2729
loop: "{{ __controller_api_inventories }}"
2830
loop_control:
2931
loop_var: current_inventory
32+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
3033

3134
- name: "Group differences (block)"
3235
when: __controller_api_groups is defined

roles/object_diff/tasks/hosts.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
query_params={'name': orgs},
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)
77
}}"
8+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
89

910
- name: "Get the API list of all inventories"
1011
ansible.builtin.set_fact:
@@ -17,6 +18,7 @@
1718
oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1819
return_all=true, max_objects=query_controller_api_max_objects)
1920
}}"
21+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
2022

2123
- name: "Get the API list of all hosts in the inventories at organization {{ orgs }}"
2224
ansible.builtin.set_fact:
@@ -25,6 +27,7 @@
2527
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
2628
return_all=true, max_objects=query_controller_api_max_objects)
2729
}}"
30+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
2831
loop: "{{ __controller_api_inventories }}"
2932
loop_control:
3033
loop_var: current_inventory

roles/object_diff/tasks/inventories.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
query_params={'name': orgs},
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)
77
}}"
8+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
89

910
- name: "Get the API list of all Inventories"
1011
ansible.builtin.set_fact:
@@ -13,6 +14,7 @@
1314
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1415
return_all=true, max_objects=query_controller_api_max_objects)
1516
}}"
17+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1618

1719
- name: "Find the difference of Inventories between what is on the Controller versus CasC on SCM"
1820
ansible.builtin.set_fact:

roles/object_diff/tasks/inventory_sources.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
query_params={'name': orgs},
66
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs)
77
}}"
8+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
89

910
- name: "Get the API list of all Inventory Sources"
1011
ansible.builtin.set_fact:
@@ -13,6 +14,7 @@
1314
host=controller_hostname, oauth_token=controller_oauthtoken, verify_ssl=controller_validate_certs,
1415
return_all=true, max_objects=query_controller_api_max_objects)
1516
}}"
17+
no_log: "{{ controller_configuration_object_diff_secure_logging }}"
1618

1719
- name: "Find the difference of Inventory Sources between what is on the Controller versus CasC on SCM"
1820
ansible.builtin.set_fact:

0 commit comments

Comments
 (0)