Skip to content

Commit 6ffc3a7

Browse files
authored
Merge branch 'devel' into fix_hub_checks
2 parents 852c2b9 + e39da68 commit 6ffc3a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+196
-181
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- repo: 'https://github.com/ansible-community/ansible-lint.git'
9-
rev: v26.1.0
9+
rev: v26.1.1
1010
hooks:
1111
# see discussions here about what arguments are used, and behavior
1212
# https://github.com/ansible/ansible-lint/issues/649
@@ -26,7 +26,7 @@ repos:
2626
hooks:
2727
- id: markdownlint-cli2
2828
- repo: https://github.com/ambv/black
29-
rev: 25.12.0
29+
rev: 26.1.0
3030
hooks:
3131
- id: black
3232
name: black
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
bugfixes:
3+
- Export only non-managed role_definitions.
4+
...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
bugfixes:
3+
- Don't export hub roles (included into the role_definitions).
4+
...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
minor_changes:
3+
- Moved the valid_tags from role vars to defaults
4+
...
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
minor_changes:
3+
- Don't read the files if they don't contains the corresponding variable
4+
- No need to initialize the variables that have to be read from the input files
5+
...

roles/filetree_create/defaults/main.yml

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,66 @@ controller_configuration_filetree_create_secure_logging: "{{ controller_configur
5959
eda_configuration_filetree_create_secure_logging: "{{ controller_configuration_secure_logging | default('false') }}"
6060
hub_configuration_filetree_create_secure_logging: "{{ controller_configuration_secure_logging | default('false') }}"
6161

62-
input_tag:
63-
- all
64-
organization: 'ORGANIZATIONLESS'
65-
6662
secrets_as_variables: true
6763
secrets_as_variables_prefix: "vaulted"
64+
65+
organization: 'ORGANIZATIONLESS'
66+
67+
input_tag:
68+
- all
69+
valid_tags:
70+
- all
71+
- controller
72+
- controller_settings
73+
- controller_credentials
74+
- controller_credential_types
75+
- controller_execution_environments
76+
- controller_groups
77+
- controller_hosts
78+
- controller_inventories
79+
- controller_inventory_sources
80+
- controller_job_templates
81+
- controller_notification_templates
82+
- controller_organizations
83+
- controller_projects
84+
- controller_roles
85+
- controller_teams
86+
- controller_users
87+
- controller_workflow_job_templates
88+
- controller_instance_groups
89+
- controller_applications
90+
- controller_labels
91+
- controller_schedules
92+
- controller_gateway_authenticator
93+
- controller_gateway_authenticator_maps
94+
- gateway
95+
- gateway_applications
96+
- gateway_authenticator_maps
97+
- gateway_authenticators
98+
- gateway_http_ports
99+
- gateway_organizations
100+
- gateway_role_definitions
101+
- gateway_role_user_assignments
102+
- gateway_routes
103+
- gateway_service_clusters
104+
- gateway_service_keys
105+
- gateway_service_nodes
106+
- gateway_services
107+
- gateway_settings
108+
- gateway_teams
109+
- gateway_users
110+
- eda
111+
- eda_credential_types
112+
- eda_credentials
113+
- eda_decision_environments
114+
- eda_event_streams
115+
- eda_projects
116+
- eda_rulebook_activations
117+
- hub
118+
- hub_namespaces
119+
- hub_collections
120+
- hub_collection_remotes
121+
- hub_collection_repositories
122+
- hub_ee_registries
123+
- hub_ee_repositories
68124
...

roles/filetree_create/tasks/all.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
- name: "Export Controller Schedules"
8080
ansible.builtin.include_tasks: "controller_schedules.yml"
8181
when: "'controller_schedules' in input_tag or 'controller' in input_tag or 'all' in input_tag"
82+
- name: "Export Gateway Roles Definitions"
83+
ansible.builtin.include_tasks: "gateway_role_definitions.yml"
84+
when: "'gateway_role_definitions' in input_tag or 'gateway' in input_tag or 'all' in input_tag"
8285
- name: "Export Gateway Applications"
8386
ansible.builtin.include_tasks: "gateway_applications.yml"
8487
when: "'gateway_applications' in input_tag or 'gateway' in input_tag or 'all' in input_tag"
@@ -164,7 +167,4 @@
164167
- name: "Export HUB EE Images"
165168
ansible.builtin.include_tasks: "hub_ee_images.yml"
166169
when: "'hub_ee_images' in input_tag or 'hub' in input_tag or 'all' in input_tag"
167-
- name: "Export HUB Roles"
168-
ansible.builtin.include_tasks: "hub_roles.yml"
169-
when: "'hub_roles' in input_tag or 'hub' in input_tag or 'all' in input_tag"
170170
...
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
- name: "Get current Gateway Role Definitions from the API"
3+
ansible.builtin.set_fact:
4+
gateway_role_definitions_lookvar: "{{ query('ansible.platform.gateway_api', '/api/gateway/v1/role_definitions/',
5+
query_params=(query_params | combine({'name': gateway_role_definition_name} if gateway_role_definition_name is defined else {})),
6+
host=aap_hostname, oauth_token=aap_oauthtoken, verify_ssl=aap_validate_certs,
7+
return_all=true, max_objects=query_gateway_api_max_objects)
8+
}}"
9+
vars:
10+
query_params:
11+
managed: false
12+
no_log: "{{ configuration_filetree_create_secure_logging }}"
13+
14+
- name: "Create the output directory for Gateway Role Definitions: {{ output_path }}"
15+
ansible.builtin.file:
16+
path: "{{ output_path }}"
17+
state: directory
18+
mode: '0755'
19+
20+
- name: "Add current Gateway Role Definitions to the gateway_role_definitions.yaml output file in {{ output_path }}"
21+
ansible.builtin.template:
22+
src: "templates/gateway_role_definitions.j2"
23+
dest: "{{ output_path }}/gateway_role_definitions.yaml"
24+
mode: '0644'
25+
vars:
26+
current_gateway_role_definitions_asset_value: "{{ gateway_role_definitions_lookvar }}"
27+
...

roles/filetree_create/tasks/hub_roles.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
gateway_role_definitions: {{ [] if current_gateway_role_definitions_asset_value | length == 0 }}
3+
{% set __excluded_fields = ['id', 'url', 'related', 'summary_fields', 'modified', 'created', 'modified_by', 'created_by', 'managed'] %}
4+
{% set __excluded_values = ['Platform Auditor'] %}
5+
{% set __list_items = [] %}
6+
{% for current_role_definition in current_gateway_role_definitions_asset_value if current_role_definition.name not in __excluded_values %}
7+
{% for __map_item in (current_role_definition | dict2items) if __map_item.key not in __excluded_fields %}
8+
{% if loop.index == 1 %}
9+
- {{ __map_item.key }}: {{ __map_item.value | default('""' if __map_item.key not in __list_items else [], true) | replace("\\'", "''") }}
10+
{% else %}
11+
{{ __map_item.key }}: {{ __map_item.value | default('""' if __map_item.key not in __list_items else [], true) | replace("\\'", "''") }}
12+
{% endif %}
13+
{%- endfor %}
14+
{% endfor %}
15+
...

0 commit comments

Comments
 (0)