Skip to content

Commit

Permalink
more role conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan committed Oct 19, 2024
1 parent e3b81d1 commit 369529c
Show file tree
Hide file tree
Showing 19 changed files with 127 additions and 63 deletions.
4 changes: 2 additions & 2 deletions roles/dispatch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ gateway_dispatch_roles:
- {role: http_ports, var: http_ports_list, tags: http_ports}
- {role: organizations, var: organizations_list, tags: organizations}
- {role: teams, var: platform_teams, tags: teams}
- {role: service_clusters, var: service_clusters_list, tags: service_clusters}
- {role: service_clusters, var: gateway_service_clusters, tags: service_clusters}
- {role: service_keys, var: service_keys_list, tags: service_keys}
- {role: service_nodes, var: service_nodes_list, tags: service_nodes}
- {role: services, var: services_list, tags: services}
- {role: routes, var: routes_list, tags: routes}
- {role: routes, var: gateway_routes, tags: routes}
- {role: role_user_assignments, var: role_user_assignments_list, tags: role_user_assignments}
```
Expand Down
4 changes: 2 additions & 2 deletions roles/dispatch/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ argument_specs:
var: aap_organizations
tags: organizations
- role: gateway_service_clusters
var: service_clusters_list
var: gateway_service_clusters
tags: service_clusters
- role: gateway_service_keys
var: service_keys_list
Expand All @@ -36,7 +36,7 @@ argument_specs:
var: role_user_assignments_list
tags: role_user_assignments
- role: gateway_routes
var: routes_list
var: gateway_routes
tags: routes
- role: gateway_teams
var: platform_teams
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_applications/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: applications
role_name: gateway_applications
author: John Westcott IV
description: An Ansible Role to create applications in Ansible gateway.
company: Red Hat
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_authenticator_maps/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: authenticator_maps
role_name: gateway_authenticator_maps
author: Martin Slemr
description: An Ansible Role to create authenticator maps in automation platform gateway.
company: Red Hat
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_authenticators/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: authenticators
role_name: gateway_authenticators
author: Martin Slemr
description: An Ansible Role to create authenticators in Automation Platform Gateway.
company: Red Hat
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_http_ports/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: http_ports
role_name: gateway_http_ports
author: Martin Slemr
description: An Ansible Role to define http ports in automation platform gateway.
company: Red Hat
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_organizations/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: organizations
role_name: gateway_organizations
author: Martin Slemr
description: An Ansible Role to create organizations in Automation Platform Gateway.
company: Red Hat
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_role_user_assignments/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: role_user_assignments
role_name: gateway_role_user_assignments
author: Martin Slemr
description: An Ansible Role to create RBAC Role User Assignments in Automation Platform gateway.
company: Red Hat
Expand Down
50 changes: 39 additions & 11 deletions roles/gateway_routes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,45 @@ http port and path in the destination service (gateway, controller, hub, eda).

## Variables

Detailed description of variables are provided in the [top-level README](../../README.md)

Variables specific for this role are following:

| Variable Name | Default Value | Required | Description | |
|:------------------------------------------------|:---------------------------------------------------:|:--------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------:|
| `routes_list` (Alias: routes) | [below](#service-arguments) | yes | Data structure describing your route entries described below. | |
| `routes_secure_logging` | `aap_configuration_secure_logging` OR `false` | no | Whether or not to include the sensitive route role tasks in the log. Set this value to `True` if you will be providing your sensitive values from elsewhere. | |
| `routes_enforce_defaults` | `aap_configuration_enforce_defaults` OR `false` | no | Whether or not to enforce default option values on only the route role. | README.md#enforcing-defaults) |
| `routes_async_retries` | `aap_configuration_async_retries` OR `30` | no | This variable sets the number of retries to attempt for the role. | |
| `routes_async_delay` | `aap_configuration_async_delay` OR `1` | no | This sets the delay between retries for the role. | |
|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`platform_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
|`aap_hostname`|""|yes|URL to the Ansible Automation Platform Server.|127.0.0.1|
|`aap_validate_certs`|`True`|no|Whether or not to validate the Ansible Automation Platform Server's SSL certificate.||
|`aap_username`|""|no|Admin User on the Ansible Automation Platform Server. Either username / password or oauthtoken need to be specified.||
|`aap_password`|""|no|Platform Admin User's password on the Server. This should be stored in an Ansible Vault at vars/platform-secrets.yml or elsewhere and called from a parent playbook.||
|`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 controller host.||
|`gateway_routes`|`see below`|yes|Data structure describing your gateway_routes Described below.||

### Secure Logging Variables

The following Variables compliment each other.
If Both variables are not set, secure logging defaults to false.
The role defaults to False as normally the add ee_registry task does not include sensitive information.
gateway_routes_secure_logging defaults to the value of aap_configuration_secure_logging if it is not explicitly called. This allows for secure logging to be toggled for the entire suite of automation hub configuration roles with a single variable, or for the user to selectively use it.

|Variable Name|Default Value|Required|Description|
|:---:|:---:|:---:|:---:|
|`gateway_routes_secure_logging`|`False`|no|Whether or not to include the sensitive Registry role tasks in the log. Set this value to `True` if you will be providing your sensitive values from elsewhere.|
|`aap_configuration_secure_logging`|`False`|no|This variable enables secure logging as well, but is shared across multiple roles, see above.|

### Asynchronous Retry Variables

The following Variables set asynchronous retries for the role.
If neither of the retries or delay or retries are set, they will default to their respective defaults.
This allows for all items to be created, then checked that the task finishes successfully.
This also speeds up the overall role.

|Variable Name|Default Value|Required|Description|
|:---:|:---:|:---:|:---:|
|`aap_configuration_async_retries`|50|no|This variable sets the number of retries to attempt for the role globally.|
|`gateway_routes_async_retries`|`aap_configuration_async_retries`|no|This variable sets the number of retries to attempt for the role.|
|`aap_configuration_async_delay`|1|no|This sets the delay between retries for the role globally.|
|`gateway_routes_async_delay`|`aap_configuration_async_delay`|no|This sets the delay between retries for the role.|
|`aap_configuration_loop_delay`|1000|no|This variable sets the loop_delay for the role globally.|
|`gateway_routes_loop_delay`|`aap_configuration_loop_delay`|no|This variable sets the loop_delay for the role.|
|`aap_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.| | |

## Data Structure

Expand Down
12 changes: 7 additions & 5 deletions roles/gateway_routes/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
# These are the default variables specific to the license role

# a list of dictionaries describing the service nodes
routes_list: []
routes_secure_logging: "{{ aap_configuration_secure_logging | default(false) }}"
routes_async_retries: "{{ aap_configuration_async_retries | default(30) }}"
routes_async_delay: "{{ aap_configuration_async_delay | default(1) }}"
routes_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}"
gateway_gateway_routes: []
gateway_routes_secure_logging: "{{ aap_configuration_secure_logging | default('false') }}"
gateway_routes_async_retries: "{{ aap_configuration_async_retries | default(30) }}"
gateway_routes_async_delay: "{{ aap_configuration_async_delay | default(1) }}"
gateway_routes_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}"
gateway_routes_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}"
aap_configuration_async_dir: null
...
8 changes: 4 additions & 4 deletions roles/gateway_routes/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ argument_specs:
main:
short_description: An Ansible Role to create service nodes on automation platform gateway.
options:
routes_list:
gateway_routes:
description: Data structure describing your service nodes
type: list
required: true
Expand Down Expand Up @@ -63,15 +63,15 @@ argument_specs:
description: Desired state of the resource.

# Async variables
routes_async_retries:
gateway_routes_async_retries:
default: "{{ aap_configuration_async_retries | default(30) }}"
required: false
description: This variable sets the number of retries to attempt for the role.
aap_configuration_async_retries:
default: 30
required: false
description: This variable sets number of retries across all roles as a default.
routes_async_delay:
gateway_routes_async_delay:
default: "{{ aap_configuration_async_delay | default(1) }}"
required: false
description: This variable sets delay between retries for the role.
Expand All @@ -88,7 +88,7 @@ argument_specs:
# No_log variables
routes_secure_logging:
gateway_routes_secure_logging:
default: "{{ aap_configuration_secure_logging | default(false) }}"
required: false
type: bool
Expand Down
2 changes: 1 addition & 1 deletion roles/gateway_routes/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
galaxy_info:
role_name: routes
role_name: gateway_routes
author: Martin Slemr
description: An Ansible Role to create service non-API routes in automation platform gateway.
company: Red Hat
Expand Down
9 changes: 6 additions & 3 deletions roles/gateway_routes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
gateway_token: "{{ aap_token | default(omit, true) }}"
gateway_request_timeout: "{{ aap_request_timeout | default(omit, true) }}"
gateway_validate_certs: "{{ aap_validate_certs | default(omit) }}"
loop: "{{ routes if routes is defined else routes_list }}"
loop: "{{ gateway_routes }}"
loop_control:
loop_var: __gateway_routes_item
no_log: "{{ routes_secure_logging }}"
label: "{{ __operation.verb }} the label {{ __gateway_routes_item.name }} to Controller"
pause: "{{ controller_configuration_labels_loop_delay }}"
no_log: "{{ gateway_routes_secure_logging }}"
async: 1000
poll: 0
register: __gateway_routes_job_async
Expand All @@ -42,8 +44,9 @@
loop: "{{ __gateway_routes_job_async.results }}"
loop_control:
loop_var: __gateway_routes_job_async_results_item
label: "{{ __operation.verb }} Label {{ __gateway_routes_job_async_results_item.__gateway_routes_item.name }} | Wait for finish the Label {{ __operation.action }}"
when: __gateway_routes_job_async_results_item.ansible_job_id is defined
no_log: "{{ routes_secure_logging }}"
no_log: "{{ gateway_routes_secure_logging }}"
vars:
ansible_async_dir: "{{ aap_configuration_async_dir | default(omit) }}"
...
54 changes: 41 additions & 13 deletions roles/gateway_service_clusters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,45 @@ An Ansible Role to configure Service Clusters on Ansible Automation gateway.

## Variables

Detailed description of variables are provided in the [top-level README](../../README.md)

Variables specific for this role are following:

| Variable Name | Default Value | Required | Description | |
|:----------------------------------------------------------|:---------------------------------------------------:|:--------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------:|
| `service_clusters_list` (Alias: service_clusters) | [below](#service-cluster-arguments) | yes | Data structure describing your service_cluster entries described below. | |
| `service_clusters_secure_logging` | `aap_configuration_secure_logging` OR `false` | no | Whether or not to include the sensitive service_cluster role tasks in the log. Set this value to `True` if you will be providing your sensitive values from elsewhere. | |
| `service_clusters_enforce_defaults` | `aap_configuration_enforce_defaults` OR `false` | no | Whether or not to enforce default option values on only the service cluster role. | README.md#enforcing-defaults) |
| `service_clusters_async_retries` | `aap_configuration_async_retries` OR `30` | no | This variable sets the number of retries to attempt for the role. | |
| `service_clusters_async_delay` | `aap_configuration_async_delay` OR `1` | no | This sets the delay between retries for the role. | |
|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`platform_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
|`aap_hostname`|""|yes|URL to the Ansible Automation Platform Server.|127.0.0.1|
|`aap_validate_certs`|`True`|no|Whether or not to validate the Ansible Automation Platform Server's SSL certificate.||
|`aap_username`|""|no|Admin User on the Ansible Automation Platform Server. Either username / password or oauthtoken need to be specified.||
|`aap_password`|""|no|Platform Admin User's password on the Server. This should be stored in an Ansible Vault at vars/platform-secrets.yml or elsewhere and called from a parent playbook.||
|`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 controller host.||
|`gateway_service_clusters`|`see below`|yes|Data structure describing your gateway_service_clusters Described below.||

### Secure Logging Variables

The following Variables compliment each other.
If Both variables are not set, secure logging defaults to false.
The role defaults to False as normally the add ee_registry task does not include sensitive information.
gateway_service_clusters_secure_logging defaults to the value of aap_configuration_secure_logging if it is not explicitly called. This allows for secure logging to be toggled for the entire suite of automation hub configuration roles with a single variable, or for the user to selectively use it.

|Variable Name|Default Value|Required|Description|
|:---:|:---:|:---:|:---:|
|`gateway_service_clusters_secure_logging`|`False`|no|Whether or not to include the sensitive Registry role tasks in the log. Set this value to `True` if you will be providing your sensitive values from elsewhere.|
|`aap_configuration_secure_logging`|`False`|no|This variable enables secure logging as well, but is shared across multiple roles, see above.|

### Asynchronous Retry Variables

The following Variables set asynchronous retries for the role.
If neither of the retries or delay or retries are set, they will default to their respective defaults.
This allows for all items to be created, then checked that the task finishes successfully.
This also speeds up the overall role.

|Variable Name|Default Value|Required|Description|
|:---:|:---:|:---:|:---:|
|`aap_configuration_async_retries`|50|no|This variable sets the number of retries to attempt for the role globally.|
|`gateway_service_clusters_async_retries`|`aap_configuration_async_retries`|no|This variable sets the number of retries to attempt for the role.|
|`aap_configuration_async_delay`|1|no|This sets the delay between retries for the role globally.|
|`gateway_service_clusters_async_delay`|`aap_configuration_async_delay`|no|This sets the delay between retries for the role.|
|`aap_configuration_loop_delay`|1000|no|This variable sets the loop_delay for the role globally.|
|`gateway_service_clusters_loop_delay`|`aap_configuration_loop_delay`|no|This variable sets the loop_delay for the role.|
|`aap_configuration_async_dir`|`null`|no|Sets the directory to write the results file for async tasks. The default value is set to `null` which uses the Ansible Default of `/root/.ansible_async/`.|

## Data Structure

Expand Down Expand Up @@ -46,7 +74,7 @@ Options for the `service_clusters_list` variable:
```json
{
"platform_state": "absent",
"service_clusters_list": [
"gateway_service_clusters": [
{
"name": "Automation Controller"
},
Expand All @@ -71,7 +99,7 @@ File name: `data/service_clusters.yml`

```yaml
---
service_clusters_list:
gateway_service_clusters:
- name: "Automation Controller"
service_type: controller
state: present
Expand Down
10 changes: 5 additions & 5 deletions roles/gateway_service_clusters/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# These are the default variables specific to the license role

# a list of dictionaries describing the service clusters
service_clusters_list: []
service_clusters_secure_logging: "{{ aap_configuration_secure_logging | default(false) }}"
service_clusters_async_retries: "{{ aap_configuration_async_retries | default(30) }}"
service_clusters_async_delay: "{{ aap_configuration_async_delay | default(1) }}"
service_clusters_enforce_defaults: "{{ aap_configuration_enforce_defaults | default(false) }}"
gateway_service_clusters: []
gateway_service_clusters_async_retries: "{{ aap_configuration_async_retries | default(30) }}"
gateway_service_clusters_async_delay: "{{ aap_configuration_async_delay | default(1) }}"
gateway_service_clusters_loop_delay: "{{ aap_configuration_loop_delay | default(0) }}"
aap_configuration_async_dir: null
...
Loading

0 comments on commit 369529c

Please sign in to comment.