mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 03:00:04 -03:30
add new name to multiple modules
This commit is contained in:
committed by
sean-m-sullivan
parent
03ed6e9755
commit
bb8efbcc82
@@ -26,6 +26,10 @@ options:
|
||||
- Name of the application.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- Description of the application.
|
||||
@@ -96,6 +100,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
description=dict(),
|
||||
authorization_grant_type=dict(choices=["password", "authorization-code"]),
|
||||
client_type=dict(choices=['public', 'confidential']),
|
||||
@@ -110,6 +115,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = module.params.get("new_name")
|
||||
description = module.params.get('description')
|
||||
authorization_grant_type = module.params.get('authorization_grant_type')
|
||||
client_type = module.params.get('client_type')
|
||||
@@ -129,7 +135,7 @@ def main():
|
||||
|
||||
# Create the data that gets sent for create and update
|
||||
application_fields = {
|
||||
'name': name,
|
||||
'name': new_name if new_name else (module.get_item_name(application) if application else name),
|
||||
'organization': org_id,
|
||||
}
|
||||
if authorization_grant_type is not None:
|
||||
|
||||
@@ -27,6 +27,10 @@ options:
|
||||
- The name of the credential type.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- The description of the credential type to give more detail about it.
|
||||
@@ -89,6 +93,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
description=dict(),
|
||||
kind=dict(choices=list(KIND_CHOICES.keys())),
|
||||
inputs=dict(type='dict'),
|
||||
@@ -101,7 +106,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = None
|
||||
new_name = module.params.get("new_name")
|
||||
kind = module.params.get('kind')
|
||||
state = module.params.get('state')
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ options:
|
||||
- Name to use for the execution environment.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- The fully qualified url of the container image.
|
||||
@@ -74,6 +78,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
image=dict(required=True),
|
||||
description=dict(default=''),
|
||||
organization=dict(),
|
||||
@@ -87,6 +92,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = module.params.get("new_name")
|
||||
image = module.params.get('image')
|
||||
description = module.params.get('description')
|
||||
state = module.params.get('state')
|
||||
@@ -98,7 +104,7 @@ def main():
|
||||
module.delete_if_needed(existing_item)
|
||||
|
||||
new_fields = {
|
||||
'name': name,
|
||||
'name': new_name if new_name else (module.get_item_name(existing_item) if existing_item else name),
|
||||
'image': image,
|
||||
}
|
||||
if description:
|
||||
|
||||
@@ -26,6 +26,10 @@ options:
|
||||
- The name to use for the inventory.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
copy_from:
|
||||
description:
|
||||
- Name or id to copy the inventory from.
|
||||
@@ -99,6 +103,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
copy_from=dict(),
|
||||
description=dict(),
|
||||
organization=dict(required=True),
|
||||
@@ -114,6 +119,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = module.params.get("new_name")
|
||||
copy_from = module.params.get('copy_from')
|
||||
description = module.params.get('description')
|
||||
organization = module.params.get('organization')
|
||||
@@ -146,7 +152,7 @@ def main():
|
||||
|
||||
# Create the data that gets sent for create and update
|
||||
inventory_fields = {
|
||||
'name': module.get_item_name(inventory) if inventory else name,
|
||||
'name': new_name if new_name else (module.get_item_name(inventory) if inventory else name),
|
||||
'organization': org_id,
|
||||
'kind': kind,
|
||||
'host_filter': host_filter,
|
||||
|
||||
@@ -28,7 +28,7 @@ options:
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looed up via the name field.
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
copy_from:
|
||||
description:
|
||||
|
||||
@@ -26,6 +26,10 @@ options:
|
||||
- Name to use for the organization.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- The description to use for the organization.
|
||||
@@ -116,6 +120,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
description=dict(),
|
||||
default_environment=dict(),
|
||||
custom_virtualenv=dict(),
|
||||
@@ -134,6 +139,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = module.params.get("new_name")
|
||||
description = module.params.get('description')
|
||||
default_ee = module.params.get('default_environment')
|
||||
custom_virtualenv = module.params.get('custom_virtualenv')
|
||||
@@ -186,7 +192,7 @@ def main():
|
||||
association_fields['galaxy_credentials'].append(module.resolve_name_to_id('credentials', item))
|
||||
|
||||
# Create the data that gets sent for create and update
|
||||
org_fields = {'name': module.get_item_name(organization) if organization else name}
|
||||
org_fields = {'name': new_name if new_name else (module.get_item_name(organization) if organization else name),}
|
||||
if description is not None:
|
||||
org_fields['description'] = description
|
||||
if default_ee is not None:
|
||||
|
||||
@@ -26,6 +26,10 @@ options:
|
||||
- Name to use for the project.
|
||||
required: True
|
||||
type: str
|
||||
new_name:
|
||||
description:
|
||||
- Setting this option will change the existing name (looked up via the name field.
|
||||
type: str
|
||||
copy_from:
|
||||
description:
|
||||
- Name or id to copy the project from.
|
||||
@@ -249,6 +253,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
name=dict(required=True),
|
||||
new_name=dict(),
|
||||
copy_from=dict(),
|
||||
description=dict(),
|
||||
scm_type=dict(choices=['manual', 'git', 'svn', 'insights'], default='manual'),
|
||||
@@ -281,6 +286,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
name = module.params.get('name')
|
||||
new_name = module.params.get("new_name")
|
||||
copy_from = module.params.get('copy_from')
|
||||
scm_type = module.params.get('scm_type')
|
||||
if scm_type == "manual":
|
||||
@@ -347,7 +353,7 @@ def main():
|
||||
|
||||
# Create the data that gets sent for create and update
|
||||
project_fields = {
|
||||
'name': module.get_item_name(project) if project else name,
|
||||
'name': new_name if new_name else (module.get_item_name(project) if project else name),
|
||||
'scm_type': scm_type,
|
||||
'organization': org_id,
|
||||
'scm_update_on_launch': scm_update_on_launch,
|
||||
|
||||
@@ -26,6 +26,10 @@ options:
|
||||
- Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
|
||||
required: True
|
||||
type: str
|
||||
new_username:
|
||||
description:
|
||||
- Setting this option will change the existing username (looked up via the name field.
|
||||
type: str
|
||||
first_name:
|
||||
description:
|
||||
- First name of the user.
|
||||
@@ -114,6 +118,7 @@ def main():
|
||||
# Any additional arguments that are not fields of the item can be added here
|
||||
argument_spec = dict(
|
||||
username=dict(required=True),
|
||||
new_username=dict(),
|
||||
first_name=dict(),
|
||||
last_name=dict(),
|
||||
email=dict(),
|
||||
@@ -129,6 +134,7 @@ def main():
|
||||
|
||||
# Extract our parameters
|
||||
username = module.params.get('username')
|
||||
new_username = module.params.get("new_username")
|
||||
first_name = module.params.get('first_name')
|
||||
last_name = module.params.get('last_name')
|
||||
email = module.params.get('email')
|
||||
@@ -149,7 +155,7 @@ def main():
|
||||
# Create the data that gets sent for create and update
|
||||
new_fields = {}
|
||||
if username is not None:
|
||||
new_fields['username'] = module.get_item_name(existing_item) if existing_item else username
|
||||
new_fields['username'] = new_username if new_username else (module.get_item_name(existing_item) if existing_item else username)
|
||||
if first_name is not None:
|
||||
new_fields['first_name'] = first_name
|
||||
if last_name is not None:
|
||||
|
||||
@@ -810,7 +810,7 @@ def main():
|
||||
)
|
||||
|
||||
# Get Workflow information in case one was just created.
|
||||
existing_item = module.get_one('workflow_job_templates', name_or_id=name, **{'data': search_fields})
|
||||
existing_item = module.get_one('workflow_job_templates', name_or_id=new_name if new_name else name, **{'data': search_fields})
|
||||
workflow_job_template_id = existing_item['id']
|
||||
# Destroy current nodes if selected.
|
||||
if destroy_current_schema:
|
||||
|
||||
Reference in New Issue
Block a user