mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-29 12:29:10 -07:00
Fix module issues (#52209)
This commit is contained in:
parent
cedd9d9926
commit
203caf2570
54 changed files with 290 additions and 238 deletions
|
@ -263,7 +263,7 @@ def main():
|
|||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
name=dict(type='list', required=True, aliases=['pkg']),
|
||||
repository_path=dict(type='str'),
|
||||
repository_path=dict(type='path'),
|
||||
accept_license=dict(type='bool', default=False),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
),
|
||||
|
|
|
@ -13,14 +13,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: rhn_register
|
||||
short_description: Manage Red Hat Network registration using the C(rhnreg_ks) command
|
||||
description:
|
||||
- Manage registration to the Red Hat Network.
|
||||
version_added: "1.2"
|
||||
author: James Laska (@jlaska)
|
||||
author:
|
||||
- James Laska (@jlaska)
|
||||
notes:
|
||||
- This is for older Red Hat products. You probably want the M(redhat_subscription) module instead.
|
||||
- In order to register a system, rhnreg_ks requires either a username and password, or an activationkey.
|
||||
|
@ -31,86 +32,93 @@ options:
|
|||
state:
|
||||
description:
|
||||
- whether to register (C(present)), or unregister (C(absent)) a system
|
||||
choices: [ "present", "absent" ]
|
||||
default: "present"
|
||||
type: str
|
||||
choices: [ absent, present ]
|
||||
default: present
|
||||
username:
|
||||
description:
|
||||
- Red Hat Network username
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Red Hat Network password
|
||||
type: str
|
||||
server_url:
|
||||
description:
|
||||
- Specify an alternative Red Hat Network server URL
|
||||
default: Current value of I(serverURL) from C(/etc/sysconfig/rhn/up2date) is the default
|
||||
- The default is the current value of I(serverURL) from C(/etc/sysconfig/rhn/up2date).
|
||||
type: str
|
||||
activationkey:
|
||||
description:
|
||||
- supply an activation key for use with registration
|
||||
type: str
|
||||
profilename:
|
||||
description:
|
||||
- supply an profilename for use with registration
|
||||
type: str
|
||||
version_added: "2.0"
|
||||
sslcacert:
|
||||
description:
|
||||
- supply a custom ssl CA certificate file for use with registration
|
||||
type: str
|
||||
version_added: "2.1"
|
||||
systemorgid:
|
||||
description:
|
||||
- supply an organizational id for use with registration
|
||||
type: str
|
||||
version_added: "2.1"
|
||||
channels:
|
||||
description:
|
||||
- Optionally specify a list of comma-separated channels to subscribe to upon successful registration.
|
||||
- Optionally specify a list of channels to subscribe to upon successful registration.
|
||||
type: list
|
||||
default: []
|
||||
enable_eus:
|
||||
description:
|
||||
- If C(no), extended update support will be requested.
|
||||
type: bool
|
||||
default: 'no'
|
||||
default: no
|
||||
nopackages:
|
||||
description:
|
||||
- If C(yes), the registered node will not upload its installed packages information to Satellite server
|
||||
type: bool
|
||||
default: 'no'
|
||||
default: no
|
||||
version_added: "2.5"
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Unregister system from RHN.
|
||||
- rhn_register:
|
||||
EXAMPLES = r'''
|
||||
- name: Unregister system from RHN
|
||||
rhn_register:
|
||||
state: absent
|
||||
username: joe_user
|
||||
password: somepass
|
||||
|
||||
# Register as user (joe_user) with password (somepass) and auto-subscribe to available content.
|
||||
- rhn_register:
|
||||
- name: Register as user with password and auto-subscribe to available content
|
||||
rhn_register:
|
||||
state: present
|
||||
username: joe_user
|
||||
password: somepass
|
||||
|
||||
# Register with activationkey (1-222333444) and enable extended update support.
|
||||
- rhn_register:
|
||||
- name: Register with activationkey and enable extended update support
|
||||
rhn_register:
|
||||
state: present
|
||||
activationkey: 1-222333444
|
||||
enable_eus: true
|
||||
|
||||
# Register with activationkey (1-222333444) and set a profilename which may differ from the hostname.
|
||||
- rhn_register:
|
||||
- name: Register with activationkey and set a profilename which may differ from the hostname
|
||||
rhn_register:
|
||||
state: present
|
||||
activationkey: 1-222333444
|
||||
profilename: host.example.com.custom
|
||||
|
||||
# Register as user (joe_user) with password (somepass) against a satellite
|
||||
# server specified by (server_url).
|
||||
- rhn_register:
|
||||
- name: Register as user with password against a satellite server
|
||||
rhn_register:
|
||||
state: present
|
||||
username: joe_user
|
||||
password: somepass'
|
||||
server_url: https://xmlrpc.my.satellite/XMLRPC
|
||||
|
||||
# Register as user (joe_user) with password (somepass) and enable
|
||||
# channels (rhel-x86_64-server-6-foo-1) and (rhel-x86_64-server-6-bar-1).
|
||||
- rhn_register:
|
||||
- name: Register as user with password and enable channels
|
||||
rhn_register:
|
||||
state: present
|
||||
username: joe_user
|
||||
password: somepass
|
||||
|
@ -338,24 +346,24 @@ def main():
|
|||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
username=dict(default=None, required=False),
|
||||
password=dict(default=None, required=False, no_log=True),
|
||||
server_url=dict(default=None, required=False),
|
||||
activationkey=dict(default=None, required=False, no_log=True),
|
||||
profilename=dict(default=None, required=False),
|
||||
sslcacert=dict(default=None, required=False, type='path'),
|
||||
systemorgid=dict(default=None, required=False),
|
||||
enable_eus=dict(default=False, type='bool'),
|
||||
nopackages=dict(default=False, type='bool'),
|
||||
channels=dict(default=[], type='list'),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
username=dict(type='str'),
|
||||
password=dict(type='str', no_log=True),
|
||||
server_url=dict(type='str'),
|
||||
activationkey=dict(type='str', no_log=True),
|
||||
profilename=dict(type='str'),
|
||||
sslcacert=dict(type='path'),
|
||||
systemorgid=dict(type='str'),
|
||||
enable_eus=dict(type='bool', default=False),
|
||||
nopackages=dict(type='bool', default=False),
|
||||
channels=dict(type='list', default=[]),
|
||||
),
|
||||
# username/password is required for state=absent, or if channels is not empty
|
||||
# (basically anything that uses self.api requires username/password) but it doesnt
|
||||
# look like we can express that with required_if/required_together/mutually_exclusive
|
||||
|
||||
# only username+password can be used for unregister
|
||||
required_if=[['state', 'absent', ['username', 'password']]]
|
||||
required_if=[['state', 'absent', ['username', 'password']]],
|
||||
)
|
||||
|
||||
if not HAS_UP2DATE_CLIENT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue