mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Break out control plane EE as its own thing
This commit is contained in:
@@ -51,7 +51,7 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
changed = False
|
changed = []
|
||||||
registry_cred = None
|
registry_cred = None
|
||||||
|
|
||||||
if options.get("registry_username"):
|
if options.get("registry_username"):
|
||||||
@@ -68,12 +68,12 @@ class Command(BaseCommand):
|
|||||||
sys.stderr.write("No registry credential type found")
|
sys.stderr.write("No registry credential type found")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
registry_cred, created = Credential.objects.get_or_create(
|
registry_cred, cred_created = Credential.objects.get_or_create(
|
||||||
name="Default Execution Environment Registry Credential", managed_by_tower=True, credential_type=registry_cred_type[0]
|
name="Default Execution Environment Registry Credential", managed_by_tower=True, credential_type=registry_cred_type[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
if created:
|
if cred_created:
|
||||||
print("Default Execution Environment Credential registered.")
|
print("'Default Execution Environment Credential' registered.")
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
"host": options.get("registry_url"),
|
"host": options.get("registry_url"),
|
||||||
@@ -84,21 +84,28 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
registry_cred.inputs = inputs
|
registry_cred.inputs = inputs
|
||||||
registry_cred.save()
|
registry_cred.save()
|
||||||
changed = True
|
changed.append(True)
|
||||||
|
|
||||||
if not created:
|
if not cred_created:
|
||||||
print('Updated Default Execution Environment Credential')
|
print("Updated 'Default Execution Environment Credential'")
|
||||||
|
|
||||||
for ee in reversed(settings.DEFAULT_EXECUTION_ENVIRONMENTS):
|
# Create default globally available Execution Environments
|
||||||
_, created = ExecutionEnvironment.objects.update_or_create(
|
for ee in reversed(settings.GLOBAL_JOB_EXECUTION_ENVIRONMENTS):
|
||||||
name=ee["name"], defaults={"image": ee["image"], "managed_by_tower": True, "credential": registry_cred}
|
_, ee_created = ExecutionEnvironment.objects.update_or_create(name=ee["name"], image=ee["image"], credential=registry_cred)
|
||||||
)
|
if ee_created:
|
||||||
|
changed.append(True)
|
||||||
|
print(f"'{ee['name']}' Default Execution Environment registered.")
|
||||||
|
|
||||||
if created:
|
# Create the control plane execution environment that is used for project updates and system jobs
|
||||||
changed = True
|
control_plane_ee = settings.CONTROL_PLANE_EXECUTION_ENVIRONMENT
|
||||||
print("Default Execution Environment(s) registered.")
|
_cp_ee, cp_created = ExecutionEnvironment.objects.update_or_create(
|
||||||
|
name="Control Plane Execution Environment", defaults={'image': control_plane_ee, 'managed_by_tower': True, 'credential': registry_cred}
|
||||||
|
)
|
||||||
|
if cp_created:
|
||||||
|
changed.append(True)
|
||||||
|
print("Control Plane Execution Environment registered.")
|
||||||
|
|
||||||
if changed:
|
if any(changed):
|
||||||
print("(changed: True)")
|
print("(changed: True)")
|
||||||
else:
|
else:
|
||||||
print("(changed: False)")
|
print("(changed: False)")
|
||||||
|
|||||||
@@ -180,7 +180,15 @@ DEFAULT_EXECUTION_ENVIRONMENT = None
|
|||||||
|
|
||||||
# This list is used for creating default EEs when running awx-manage create_preload_data.
|
# This list is used for creating default EEs when running awx-manage create_preload_data.
|
||||||
# Should be ordered from highest to lowest precedence.
|
# Should be ordered from highest to lowest precedence.
|
||||||
DEFAULT_EXECUTION_ENVIRONMENTS = [{'name': 'AWX EE 0.2.0', 'image': 'quay.io/ansible/awx-ee:0.2.0'}]
|
# The awx-manage register_default_execution_environments command reads this setting and registers the EE(s)
|
||||||
|
# If a registry credential is needed to pull the image, that can be provided to the awx-manage command
|
||||||
|
GLOBAL_JOB_EXECUTION_ENVIRONMENTS = [{'name': 'AWX EE 0.3.0', 'image': 'quay.io/ansible/awx-ee:0.3.0'}]
|
||||||
|
# This setting controls which EE will be used for project updates.
|
||||||
|
# The awx-manage register_default_execution_environments command reads this setting and registers the EE
|
||||||
|
# This image is distinguished from others by having "managed_by_tower" set to True and users have limited
|
||||||
|
# ability to modify it through the API.
|
||||||
|
# If a registry credential is needed to pull the image, that can be provided to the awx-manage command
|
||||||
|
CONTROL_PLANE_EXECUTION_ENVIRONMENT = 'quay.io/ansible/awx-ee:0.3.0'
|
||||||
|
|
||||||
# Note: This setting may be overridden by database settings.
|
# Note: This setting may be overridden by database settings.
|
||||||
STDOUT_MAX_BYTES_DISPLAY = 1048576
|
STDOUT_MAX_BYTES_DISPLAY = 1048576
|
||||||
|
|||||||
Reference in New Issue
Block a user