mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Updating modules for prevent_instance_group_fallback
This commit is contained in:
29
awx/main/migrations/0168_prevent_instance_fallback.py
Normal file
29
awx/main/migrations/0168_prevent_instance_fallback.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Generated by Django 3.2.13 on 2022-09-09 17:03
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0167_project_signature_validation_credential'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='inventory',
|
||||||
|
name='prevent_instance_group_fallback',
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text='If enabled, the inventory will prevent adding any organization instance groups to the list of preferred instances groups to run associated job templates on.',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='jobtemplate',
|
||||||
|
name='prevent_instance_group_fallback',
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text='If enabled, the job template will prevent adding any inventory or organization instance groups to the list of preferred instances groups to run on.',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -66,6 +66,10 @@ options:
|
|||||||
- list of Instance Groups for this Organization to run on.
|
- list of Instance Groups for this Organization to run on.
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
|
prevent_instance_group_fallback:
|
||||||
|
description:
|
||||||
|
- Prevent falling back to instance groups set on the organization
|
||||||
|
type: bool
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Desired state of the resource.
|
- Desired state of the resource.
|
||||||
@@ -111,6 +115,7 @@ def main():
|
|||||||
kind=dict(choices=['', 'smart'], default=''),
|
kind=dict(choices=['', 'smart'], default=''),
|
||||||
host_filter=dict(),
|
host_filter=dict(),
|
||||||
instance_groups=dict(type="list", elements='str'),
|
instance_groups=dict(type="list", elements='str'),
|
||||||
|
prevent_instance_group_fallback=dict(type='bool'),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -127,6 +132,7 @@ def main():
|
|||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
kind = module.params.get('kind')
|
kind = module.params.get('kind')
|
||||||
host_filter = module.params.get('host_filter')
|
host_filter = module.params.get('host_filter')
|
||||||
|
prevent_instance_group_fallback = module.params.get('prevent_instance_group_fallback')
|
||||||
|
|
||||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||||
org_id = module.resolve_name_to_id('organizations', organization)
|
org_id = module.resolve_name_to_id('organizations', organization)
|
||||||
@@ -157,6 +163,8 @@ def main():
|
|||||||
'kind': kind,
|
'kind': kind,
|
||||||
'host_filter': host_filter,
|
'host_filter': host_filter,
|
||||||
}
|
}
|
||||||
|
if prevent_instance_group_fallback is not None:
|
||||||
|
inventory_fields['prevent_instance_group_fallback'] = prevent_instance_group_fallback
|
||||||
if description is not None:
|
if description is not None:
|
||||||
inventory_fields['description'] = description
|
inventory_fields['description'] = description
|
||||||
if variables is not None:
|
if variables is not None:
|
||||||
|
|||||||
@@ -315,6 +315,10 @@ options:
|
|||||||
- list of notifications to send on error
|
- list of notifications to send on error
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
|
prevent_instance_group_fallback:
|
||||||
|
description:
|
||||||
|
- Prevent falling back to instance groups set on the associated inventory or organization
|
||||||
|
type: bool
|
||||||
|
|
||||||
extends_documentation_fragment: awx.awx.auth
|
extends_documentation_fragment: awx.awx.auth
|
||||||
|
|
||||||
@@ -441,6 +445,7 @@ def main():
|
|||||||
notification_templates_started=dict(type="list", elements='str'),
|
notification_templates_started=dict(type="list", elements='str'),
|
||||||
notification_templates_success=dict(type="list", elements='str'),
|
notification_templates_success=dict(type="list", elements='str'),
|
||||||
notification_templates_error=dict(type="list", elements='str'),
|
notification_templates_error=dict(type="list", elements='str'),
|
||||||
|
prevent_instance_group_fallback=dict(type="bool"),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -539,6 +544,7 @@ def main():
|
|||||||
'custom_virtualenv',
|
'custom_virtualenv',
|
||||||
'job_slice_count',
|
'job_slice_count',
|
||||||
'webhook_service',
|
'webhook_service',
|
||||||
|
'prevent_instance_group_fallback',
|
||||||
):
|
):
|
||||||
field_val = module.params.get(field_name)
|
field_val = module.params.get(field_name)
|
||||||
if field_val is not None:
|
if field_val is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user