Skip to content

Commit

Permalink
revised enforced defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan committed Apr 28, 2023
1 parent 68e5366 commit 9016f1a
Show file tree
Hide file tree
Showing 28 changed files with 200 additions and 279 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- '*_'
- devel
- revised_default
tags:
- '*_' # ending underscore for trying things
- 'v[0-9]+.[0-9]+.[0-9]+' # final version
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- '*_' # ending underscore for trying things
- devel
- revised_default
tags:
- '*_' # ending underscore for trying things
- 'v[0-9]+.[0-9]+.[0-9]+' # final version
Expand Down
2 changes: 1 addition & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[defaults]
collections_paths=collections:/home/runner/collections
collections_paths=/home/runner/collections
roles_path=roles/
lookup_plugins=plugins/lookup/
74 changes: 0 additions & 74 deletions plugins/lookup/enforce_defaults.py

This file was deleted.

4 changes: 2 additions & 2 deletions roles/applications/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
name: "{{ __application_item.name | mandatory }}"
new_name: "{{ __application_item.new_name | default(omit, true) }}"
organization: "{{ __application_item.organization | mandatory }}"
description: "{{ __application_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_applications_enforce_defaults , default_value='', omit_value=omit), true) }}"
description: "{{ __application_item.description | default(( '' if controller_configuration_applications_enforce_defaults else omit), true) }}"
authorization_grant_type: "{{ __application_item.authorization_grant_type | default('password') }}"
client_type: "{{ __application_item.client_type | default('public') }}"
redirect_uris: "{{ __application_item.redirect_uris | default([]) }}"
skip_authorization: "{{ __application_item.skip_authorization | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_applications_enforce_defaults , default_value=false, omit_value=omit), true) }}"
skip_authorization: "{{ __application_item.skip_authorization | default(( false if controller_configuration_applications_enforce_defaults else omit), true) }}"
state: "{{ __application_item.state | default(controller_state | default('present')) }}"

# Role specific options
Expand Down
4 changes: 2 additions & 2 deletions roles/credential_input_sources/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
target_credential: "{{ __cred_input_src_item.target_credential | mandatory }}"
input_field_name: "{{ __cred_input_src_item.input_field_name | mandatory }}"
source_credential: "{{ __cred_input_src_item.source_credential | default(omit, true) }}"
description: "{{ __cred_input_src_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credential_input_sources_enforce_defaults , default_value='', omit_value=omit), true) }}"
metadata: "{{ __cred_input_src_item.metadata | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credential_input_sources_enforce_defaults , default_value={}, omit_value=omit), true) }}"
description: "{{ __cred_input_src_item.description | default(( '' if controller_configuration_credential_input_sources_enforce_defaults else omit), true) }}"
metadata: "{{ __cred_input_src_item.metadata | default(( {} if controller_configuration_credential_input_sources_enforce_defaults else omit), true) }}"
state: "{{ __cred_input_src_item.state | default(controller_state | default('present')) }}"

# Role specific options
Expand Down
6 changes: 3 additions & 3 deletions roles/credential_types/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
credential_type:
name: "{{ __controller_credential_type_item.name | mandatory }}"
new_name: "{{ __controller_credential_type_item.new_name | default(omit, true) }}"
description: "{{ __controller_credential_type_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credential_types_enforce_defaults , default_value='', omit_value=omit), true) }}"
injectors: "{{ __controller_credential_type_item.injectors | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credential_types_enforce_defaults , default_value={}, omit_value=omit), true) | regex_replace('[ ]{2,}', '') }}"
inputs: "{{ __controller_credential_type_item.inputs | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credential_types_enforce_defaults , default_value={}, omit_value=omit), true) }}"
description: "{{ __controller_credential_type_item.description | default(( '' if controller_configuration_credential_types_enforce_defaults else omit), true) }}"
injectors: "{{ __controller_credential_type_item.injectors | default(( {} if controller_configuration_credential_types_enforce_defaults else omit), true) | regex_replace('[ ]{2,}', '') }}"
inputs: "{{ __controller_credential_type_item.inputs | default(( {} if controller_configuration_credential_types_enforce_defaults else omit), true) }}"
kind: "{{ __controller_credential_type_item.kind | default('cloud') }}"
state: "{{ __controller_credential_type_item.state | default(controller_state | default('present')) }}"

Expand Down
12 changes: 6 additions & 6 deletions roles/credentials/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
name: "{{ __controller_credentials_item.name | mandatory }}"
new_name: "{{ __controller_credentials_item.new_name | default(omit, true) }}"
copy_from: "{{ __controller_credentials_item.copy_from | default(omit, true) }}"
description: "{{ __controller_credentials_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value='', omit_value=omit), true) }}"
organization: "{{ __controller_credentials_item.organization.name | default(__controller_credentials_item.organization | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value='', omit_value=omit), true)) }}"
description: "{{ __controller_credentials_item.description | default(( '' if controller_configuration_credentials_enforce_defaults else omit), true) }}"
organization: "{{ __controller_credentials_item.organization.name | default(__controller_credentials_item.organization | default(( '' if controller_configuration_credentials_enforce_defaults else omit), true)) }}"
credential_type: "{{ __controller_credentials_item.credential_type.name | default(__controller_credentials_item.credential_type | mandatory ) }}"
inputs: "{{ __controller_credentials_item.inputs | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value={}, omit_value=omit), true) }}"
user: "{{ __controller_credentials_item.user.username | default(__controller_credentials_item.user | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value='', omit_value=omit), true)) }}"
team: "{{ __controller_credentials_item.team.name | default(__controller_credentials_item.team | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value='', omit_value=omit), true)) }}"
update_secrets: "{{ __controller_credentials_item.update_secrets | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_credentials_enforce_defaults , default_value=true, omit_value=omit), true) }}"
inputs: "{{ __controller_credentials_item.inputs | default(( {} if controller_configuration_credentials_enforce_defaults else omit), true) }}"
user: "{{ __controller_credentials_item.user.username | default(__controller_credentials_item.user | default(( '' if controller_configuration_credentials_enforce_defaults else omit), true)) }}"
team: "{{ __controller_credentials_item.team.name | default(__controller_credentials_item.team | default(( '' if controller_configuration_credentials_enforce_defaults else omit), true)) }}"
update_secrets: "{{ __controller_credentials_item.update_secrets | default(( true if controller_configuration_credentials_enforce_defaults else omit), true) }}"
state: "{{ __controller_credentials_item.state | default(controller_state | default('present')) }}"

# Role specific options
Expand Down
8 changes: 4 additions & 4 deletions roles/execution_environments/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
execution_environment:
name: "{{ __execution_environments_item.name | mandatory }}"
new_name: "{{ __execution_environments_item.new_name | default(omit, true) }}"
description: "{{ __execution_environments_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_execution_environments_enforce_defaults , default_value='', omit_value=omit), true) }}"
description: "{{ __execution_environments_item.description | default(( '' if controller_configuration_execution_environments_enforce_defaults else omit), true) }}"
image: "{{ __execution_environments_item.image | mandatory }}"
organization: "{{ __execution_environments_item.organization.name | default(__execution_environments_item.organization | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_execution_environments_enforce_defaults , default_value='', omit_value=omit), true)) }}"
credential: "{{ __execution_environments_item.credential | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_execution_environments_enforce_defaults , default_value='', omit_value=omit), true) }}"
pull: "{{ __execution_environments_item.pull | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_execution_environments_enforce_defaults , default_value='missing', omit_value=omit), true) }}"
organization: "{{ __execution_environments_item.organization.name | default(__execution_environments_item.organization | default(( '' if controller_configuration_execution_environments_enforce_defaults else omit), true)) }}"
credential: "{{ __execution_environments_item.credential | default(( '' if controller_configuration_execution_environments_enforce_defaults else omit), true) }}"
pull: "{{ __execution_environments_item.pull | default(( 'missing' if controller_configuration_execution_environments_enforce_defaults else omit), true) }}"
state: "{{ __execution_environments_item.state | default(controller_state | default('present')) }}"

# Role specific options
Expand Down
12 changes: 6 additions & 6 deletions roles/groups/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
group:
name: "{{ controller_groups_item.name | mandatory }}"
new_name: "{{ controller_groups_item.new_name | default(omit, true) }}"
description: "{{ controller_groups_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value='', omit_value=omit), true) }}"
description: "{{ controller_groups_item.description | default(( '' if controller_configuration_groups_enforce_defaults else omit), true) }}"
inventory: "{{ controller_groups_item.inventory | mandatory }}"
variables: "{{ controller_groups_item.variables | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value={}, omit_value=omit), true) | regex_replace('[ ]{2,}', '') }}"
hosts: "{{ controller_groups_item.hosts | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value=[], omit_value=omit), true) }}"
children: "{{ controller_groups_item.children | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value=[], omit_value=omit), true) }}"
preserve_existing_hosts: "{{ controller_groups_item.preserve_existing_hosts | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value=false, omit_value=omit)) }}"
preserve_existing_children: "{{ controller_groups_item.preserve_existing_children | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_groups_enforce_defaults , default_value=false, omit_value=omit)) }}"
variables: "{{ controller_groups_item.variables | default(( {} if controller_configuration_groups_enforce_defaults else omit), true) | regex_replace('[ ]{2,}', '') }}"
hosts: "{{ controller_groups_item.hosts | default(( [] if controller_configuration_groups_enforce_defaults else omit), true) }}"
children: "{{ controller_groups_item.children | default(( [] if controller_configuration_groups_enforce_defaults else omit), true) }}"
preserve_existing_hosts: "{{ controller_groups_item.preserve_existing_hosts | default(( false if controller_configuration_groups_enforce_defaults else omit)) }}"
preserve_existing_children: "{{ controller_groups_item.preserve_existing_children | default(( false if controller_configuration_groups_enforce_defaults else omit)) }}"
state: "{{ controller_groups_item.state | default(controller_state | default('present')) }}"

# Role Standard Options
Expand Down
6 changes: 3 additions & 3 deletions roles/hosts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
host:
name: "{{ __controller_host_item.name | mandatory }}"
new_name: "{{ __controller_host_item.new_name | default(omit, true) }}"
description: "{{ __controller_host_item.description | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_host_enforce_defaults , default_value='', omit_value=omit), true) }}"
description: "{{ __controller_host_item.description | default(( '' if controller_configuration_host_enforce_defaults else omit), true) }}"
inventory: "{{ __controller_host_item.inventory | mandatory }}"
enabled: "{{ __controller_host_item.enabled | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_host_enforce_defaults , default_value=true, omit_value=omit), true) }}"
enabled: "{{ __controller_host_item.enabled | default(( false if controller_configuration_host_enforce_defaults else omit), true) }}"
state: "{{ __controller_host_item.state | default(controller_state | default('present')) }}"
variables: "{{ __controller_host_item.variables | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=controller_configuration_host_enforce_defaults , default_value={}, omit_value=omit), true) | regex_replace('[ ]{2,}', '') }}"
variables: "{{ __controller_host_item.variables | default(( {} if controller_configuration_host_enforce_defaults else omit), true) | regex_replace('[ ]{2,}', '') }}"

# Role Standard Options
controller_host: "{{ controller_hostname | default(omit, true) }}"
Expand Down
Loading

0 comments on commit 9016f1a

Please sign in to comment.