Skip to content

Commit

Permalink
Org environment fix (#672)
Browse files Browse the repository at this point in the history
* test sanity change

* update

* fix bugs in org and licence roles
  • Loading branch information
sean-m-sullivan authored Aug 15, 2023
1 parent 89325f8 commit b513a43
Show file tree
Hide file tree
Showing 36 changed files with 40 additions and 77 deletions.
7 changes: 7 additions & 0 deletions changelogs/fragments/licence_org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bugfixes:
- Fixed issue with organization role not acceppting default environments option correctly.
- Fixed issue with licence role not operating properly, when a controller never had credentials provided for subscription lookup. See Role Readme for proper usuage.
minor_changes:
- licence role now uses a boolean of controller_license.use_looup to determine whether to lookup subscriptions. A lookup is only needed to refresh the available pools, or if it has never been done. See Role Readme for details.
...
2 changes: 0 additions & 2 deletions roles/ad_hoc_command/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/ad_hoc_command_cancel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/applications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/bulk_host_create/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_hostname`|""|yes|URL to the Ansible Controller Server.|127.0.0.1|
Expand Down
2 changes: 0 additions & 2 deletions roles/bulk_job_launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/credential_input_sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/credential_types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/execution_environments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/hosts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/instance_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/instances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/inventories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/inventory_source_update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/inventory_sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/job_launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/job_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/jobs_cancel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/labels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
20 changes: 10 additions & 10 deletions roles/license/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

An Ansible Role to deploy a license on Ansible Controller.

This will either accept a manifest file, or use redhat subscription account credentials to lookup available subscriptions and use them.

## Requirements

ansible-galaxy collection install -r tests/collections/requirements.yml to be installed
Expand All @@ -14,8 +16,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand All @@ -25,6 +25,8 @@ Currently:
|`controller_password`|""|no|Controller Admin User's password on the Ansible Controller Server. This should be stored in an Ansible Vault at vars/controller-secrets.yml or elsewhere and called from a parent playbook. Either username / password or oauthtoken need to be specified.||
|`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_license`|`see below`|yes|Data structure describing your license for controller, described below.||
|`redhat_subscription_username`|""|no|Red Hat or Red Hat Satellite username to get available subscriptions. Used only for Subscription lookup implementation.|
|`redhat_subscription_password`|""|no|Red Hat or Red Hat Satellite password to get available subscriptions. Used only for Subscription lookup implementation.|

### Secure Logging Variables

Expand Down Expand Up @@ -59,23 +61,18 @@ The module and this role can use either a manifest file, or lookup the subscript
|`force`|`False`|no|bool|By default, the license manifest will only be applied if controller is currently unlicensed or trial licensed. When force=true, the license is always applied.|
|`state`|`present`|no|str|Desired state of the resource.|

For further details on fields see <https://docs.ansible.com/automation-controller/latest/html/userguide/credential_plugins.html>

### License Variables for using Red Hat Subscription

|Variable Name|Default Value|Required|Type|Description|
|:---:|:---:|:---:|:---:|:---:|
|`redhat_subscription_username`|""|no|str|Red Hat or Red Hat Satellite username to get available subscriptions.|
|`redhat_subscription_password`|""|no|str|Red Hat or Red Hat Satellite password to get available subscriptions.|
|`filters`|"default values"|no|str|dict of filters to use to narrow the subscription. See example below for how to use this.|
|`support_level`|"Self-Support"|no|str|DEPRECATED - changed to `manifest_file` (still works as an alias)|
|`list_num`|0|no|int|List index of the subscription to use, if you want to overide the default, it is recomended to use the filters to limit the pools found.|
|`pool_id`|""|no|str|Red Hat or Red Hat Satellite pool_id to attach to, setting this will skip the lookup.|
|`pool_id`|""|no|str|Red Hat or Red Hat Satellite pool_id to attach to.|
|`force`|`False`|no|bool|By default, the license will only be applied if controller is currently unlicensed or trial licensed. When force=true, the license is always applied.|
|`use_lookup`|`False`|no|bool|Whether or not to lookup subscriptions.|
|`state`|`present`|no|str|Desired state of the resource.|

For further details on fields see <https://docs.ansible.com/automation-controller/latest/html/userguide/credential_plugins.html>

### Standard Project Data Structure

#### Json Example
Expand Down Expand Up @@ -137,7 +134,10 @@ controller_license:
controller_password: changeme
redhat_subscription_username: changeme
redhat_subscription_password: changeme

controller_license:
filters:
product_name: "Red Hat Ansible Automation Platform"
support_level: "Self-Support"
roles:
- {role: infra.controller_configuration.license}
```
Expand Down
22 changes: 19 additions & 3 deletions roles/license/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ argument_specs:
short_description: An Ansible Role to deploy a license on Ansible Controller.

options:
controller_labels:
controller_license:
description: Data structure describing your license for Controller
type: list
elements: dict
type: dict
# options:
# manifest_file:
# required: false
Expand Down Expand Up @@ -46,6 +45,23 @@ argument_specs:
# required: false
# type: bool
# description: By default, the license manifest will only be applied if controller is currently unlicensed or trial licensed. When force=true, the license is always applied.
# use_lookup:
# default: false
# required: false
# type: bool
# description: Whether or not to lookup subscriptions.

# Variables used for Liscense lookup
redhat_subscription_username:
default: None
required: false
type: str
description: Red Hat or Red Hat Satellite username to get available subscriptions.
redhat_subscription_password:
default: None
required: false
type: str
description: Red Hat or Red Hat Satellite password to get available subscriptions.

# No_log variables
controller_configuration_labels_secure_logging:
Expand Down
4 changes: 3 additions & 1 deletion roles/license/tasks/subscription.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
controller_config_file: "{{ controller_config_file | default(omit, true) }}"
validate_certs: "{{ controller_validate_certs | default(omit) }}"
register: subscription
when: controller_license.pool_id is not defined
when:
- "'use_lookup' in controller_license"
- controller_license.use_lookup

- name: Install the Controller license
license:
Expand Down
2 changes: 0 additions & 2 deletions roles/notification_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/organizations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
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 @@ -6,7 +6,7 @@
custom_virtualenv: "{{ __controller_organizations_item.custom_virtualenv | default(omit, true) }}"
max_hosts: "{{ __controller_organizations_item.max_hosts | default(omit, true) }}"
instance_groups: "{{ __controller_organizations_item.instance_groups | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
default_environment: "{{ (__controller_organizations_item.default_environment.name | default(__controller_organizations_item.execution_environment | default(omit))) if (assign_default_ee_to_org is defined and assign_default_ee_to_org) else omit }}"
default_environment: "{{ (__controller_organizations_item.default_environment.name | default(__controller_organizations_item.default_environment | default(__controller_organizations_item.execution_environment | default(omit)))) if (assign_default_ee_to_org is defined and assign_default_ee_to_org) else omit }}"
galaxy_credentials: "{{ (__controller_organizations_item.galaxy_credentials | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true)) if (assign_galaxy_credentials_to_org is defined and assign_galaxy_credentials_to_org) else omit }}"
notification_templates_approvals: "{{ (__controller_organizations_item.related.notification_templates_approvals | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_approvals is defined) | default(__controller_organizations_item.notification_templates_approvals) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__controller_organizations_item.related.notification_templates_started | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_started is defined) | default(__controller_organizations_item.notification_templates_started) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
Expand Down
2 changes: 0 additions & 2 deletions roles/project_update/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|str|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/schedules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/teams/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
2 changes: 0 additions & 2 deletions roles/workflow_job_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Currently:

## Variables

### Authentication

|Variable Name|Default Value|Required|Description|Example|
|:---|:---:|:---:|:---|:---|
|`controller_state`|"present"|no|The state all objects will take unless overridden by object default|'absent'|
Expand Down
Loading

0 comments on commit b513a43

Please sign in to comment.