mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add aliases for parameters to rhsm_repository module (#35800)
Allow 'enabled' and 'disabled' as synonymns to 'present' and 'absent'. Minor updates to module docs.
This commit is contained in:
parent
ecdb04119b
commit
6264a55cdc
1 changed files with 6 additions and 6 deletions
|
@ -15,13 +15,13 @@ DOCUMENTATION = '''
|
||||||
module: rhsm_repository
|
module: rhsm_repository
|
||||||
short_description: Manage RHSM repositories using the subscription-manager command
|
short_description: Manage RHSM repositories using the subscription-manager command
|
||||||
description:
|
description:
|
||||||
- Manage(List/Enable/Disable) RHSM repositories to the Red Hat Subscription
|
- Manage(Enable/Disable) RHSM repositories to the Red Hat Subscription
|
||||||
Management entitlement platform using the C(subscription-manager) command.
|
Management entitlement platform using the C(subscription-manager) command.
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
author: Giovanni Sciortino (@giovannisciortino)
|
author: Giovanni Sciortino (@giovannisciortino)
|
||||||
notes:
|
notes:
|
||||||
- In order to manage RHSM repositories the system must be already registered
|
- In order to manage RHSM repositories the system must be already registered
|
||||||
to RHSM manually or using the ansible module redhat_subscription.
|
to RHSM manually or using the Ansible C(redhat_subscription) module.
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- subscription-manager
|
- subscription-manager
|
||||||
|
@ -30,7 +30,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- If state is equal to present or disabled, indicates the desired
|
- If state is equal to present or disabled, indicates the desired
|
||||||
repository state.
|
repository state.
|
||||||
choices: [present, absent]
|
choices: [present, enabled, absent, disabled]
|
||||||
required: True
|
required: True
|
||||||
default: "present"
|
default: "present"
|
||||||
name:
|
name:
|
||||||
|
@ -183,14 +183,14 @@ def repository_modify(module, state, name):
|
||||||
results.append("%s is not a valid repository ID" % repoid)
|
results.append("%s is not a valid repository ID" % repoid)
|
||||||
module.fail_json(results=results, msg="%s is not a valid repository ID" % repoid)
|
module.fail_json(results=results, msg="%s is not a valid repository ID" % repoid)
|
||||||
for repo in matched_existing_repo[repoid]:
|
for repo in matched_existing_repo[repoid]:
|
||||||
if state == 'disabled':
|
if state in ['disabled', 'absent']:
|
||||||
if repo['enabled']:
|
if repo['enabled']:
|
||||||
changed = True
|
changed = True
|
||||||
diff_before += "Repository '%s' is enabled for this system\n" % repo['id']
|
diff_before += "Repository '%s' is enabled for this system\n" % repo['id']
|
||||||
diff_after += "Repository '%s' is disabled for this system\n" % repo['id']
|
diff_after += "Repository '%s' is disabled for this system\n" % repo['id']
|
||||||
results.append("Repository '%s' is disabled for this system" % repo['id'])
|
results.append("Repository '%s' is disabled for this system" % repo['id'])
|
||||||
rhsm_arguments += ['--disable', repo['id']]
|
rhsm_arguments += ['--disable', repo['id']]
|
||||||
elif state == 'enabled':
|
elif state in ['enabled', 'present']:
|
||||||
if not repo['enabled']:
|
if not repo['enabled']:
|
||||||
changed = True
|
changed = True
|
||||||
diff_before += "Repository '%s' is disabled for this system\n" % repo['id']
|
diff_before += "Repository '%s' is disabled for this system\n" % repo['id']
|
||||||
|
@ -213,7 +213,7 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
name=dict(type='list', required=True),
|
name=dict(type='list', required=True),
|
||||||
state=dict(choices=['enabled', 'disabled'], default='enabled'),
|
state=dict(choices=['enabled', 'disabled', 'present', 'absent'], default='enabled'),
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue