From 23fb36e7dd72f0d5b2472e5a7b826a4e9a35048a Mon Sep 17 00:00:00 2001 From: David Danielsson Date: Tue, 9 Jul 2024 12:10:54 -0500 Subject: [PATCH] instance group skip option when creating orgs (#859) * modified: roles/organizations/defaults/main.yml modified: roles/organizations/tasks/main.yml * modified: roles/organizations/tasks/main.yml * modified: plugins/lookup/controller_object_diff.py modified: plugins/modules/controller_export_diff.py modified: roles/organizations/tasks/main.yml --- plugins/lookup/controller_object_diff.py | 1 + plugins/modules/controller_export_diff.py | 1 + roles/organizations/defaults/main.yml | 1 + roles/organizations/tasks/main.yml | 6 +++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/lookup/controller_object_diff.py b/plugins/lookup/controller_object_diff.py index 5b168bd3c..ebd776ae6 100644 --- a/plugins/lookup/controller_object_diff.py +++ b/plugins/lookup/controller_object_diff.py @@ -76,6 +76,7 @@ name: infra.controller_configuration.projects vars: controller_projects: "{{ project_difference }}" +... """ RETURN = """ diff --git a/plugins/modules/controller_export_diff.py b/plugins/modules/controller_export_diff.py index 4b0b0d344..965658fd2 100644 --- a/plugins/modules/controller_export_diff.py +++ b/plugins/modules/controller_export_diff.py @@ -200,6 +200,7 @@ controller_password: secret123 validate_certs: false register: export_results +... """ import logging diff --git a/roles/organizations/defaults/main.yml b/roles/organizations/defaults/main.yml index 49047d1cd..5538411e8 100644 --- a/roles/organizations/defaults/main.yml +++ b/roles/organizations/defaults/main.yml @@ -9,4 +9,5 @@ controller_configuration_organizations_enforce_defaults: "{{ controller_configur assign_galaxy_credentials_to_org: true assign_default_ee_to_org: true assign_notification_templates_to_org: true +assign_instance_groups_to_org: true ... diff --git a/roles/organizations/tasks/main.yml b/roles/organizations/tasks/main.yml index 9fdc415c5..650af22cb 100644 --- a/roles/organizations/tasks/main.yml +++ b/roles/organizations/tasks/main.yml @@ -5,11 +5,11 @@ new_name: "{{ __controller_organizations_item.new_name | default(omit) }}" description: "{{ __controller_organizations_item.description | default(('' if controller_configuration_organizations_enforce_defaults else omit), true) }}" custom_virtualenv: "{{ __controller_organizations_item.custom_virtualenv | default(omit, true) }}" - max_hosts: "{{ __controller_organizations_item.max_hosts | default(( 0 if controller_configuration_organizations_enforce_defaults else omit), true) }}" - instance_groups: "{{ __controller_organizations_item.instance_groups | default(([] if controller_configuration_organizations_enforce_defaults else omit), true) }}" + max_hosts: "{{ __controller_organizations_item.max_hosts | default((0 if controller_configuration_organizations_enforce_defaults else omit), true) }}" + instance_groups: "{{ (__controller_organizations_item.instance_groups | default(([] if controller_configuration_organizations_enforce_defaults else omit), true)) if (assign_instance_groups_to_org is defined and assign_instance_groups_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) if (assign_notification_templates_to_org is defined and assign_notification_templates_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) if (assign_notification_templates_to_org is defined and assign_notification_templates_to_org) else omit }}" 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) if (assign_notification_templates_to_org is defined and assign_notification_templates_to_org) else omit }}" notification_templates_success: "{{ (__controller_organizations_item.related.notification_templates_success | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_success is defined) | default(__controller_organizations_item.notification_templates_success) | default(([] if controller_configuration_organizations_enforce_defaults else omit), true) if (assign_notification_templates_to_org is defined and assign_notification_templates_to_org) else omit }}" notification_templates_error: "{{ (__controller_organizations_item.related.notification_templates_error | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_error is defined) | default(__controller_organizations_item.notification_templates_error) | default(([] if controller_configuration_organizations_enforce_defaults else omit), true) if (assign_notification_templates_to_org is defined and assign_notification_templates_to_org) else omit }}"