mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 12:33:59 -07:00
ipa_host: add userclass and locality parameters (#10935)
* ipa_host: add userclass and locality parameters * Changelog Fragment - 10935 * Update plugins/modules/ipa_host.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/ipa_host.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/ipa_host.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/10935-ipa-host-add-parameters.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7572b46c7b
commit
66578d0b2c
2 changed files with 24 additions and 1 deletions
2
changelogs/fragments/10935-ipa-host-add-parameters.yml
Normal file
2
changelogs/fragments/10935-ipa-host-add-parameters.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- ipa_host - add ``userclass`` and ``locality`` parameters (https://github.com/ansible-collections/community.general/pull/10935).
|
|
@ -28,6 +28,11 @@ options:
|
||||||
description:
|
description:
|
||||||
- A description of this host.
|
- A description of this host.
|
||||||
type: str
|
type: str
|
||||||
|
userclass:
|
||||||
|
description:
|
||||||
|
- Host category (semantics placed on this attribute are for local interpretation).
|
||||||
|
type: str
|
||||||
|
version_added: 12.0.0
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- Force host name even if not in DNS.
|
- Force host name even if not in DNS.
|
||||||
|
@ -46,6 +51,12 @@ options:
|
||||||
aliases: ["macaddress"]
|
aliases: ["macaddress"]
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
|
l:
|
||||||
|
description:
|
||||||
|
- Host locality (for example V(Baltimore, MD)).
|
||||||
|
aliases: ["locality"]
|
||||||
|
type: str
|
||||||
|
version_added: 12.0.0
|
||||||
ns_host_location:
|
ns_host_location:
|
||||||
description:
|
description:
|
||||||
- Host location (for example V(Lab 2)).
|
- Host location (for example V(Lab 2)).
|
||||||
|
@ -101,7 +112,9 @@ EXAMPLES = r"""
|
||||||
community.general.ipa_host:
|
community.general.ipa_host:
|
||||||
name: host01.example.com
|
name: host01.example.com
|
||||||
description: Example host
|
description: Example host
|
||||||
|
userclass: Server
|
||||||
ip_address: 192.168.0.123
|
ip_address: 192.168.0.123
|
||||||
|
locality: Baltimore, MD
|
||||||
ns_host_location: Lab
|
ns_host_location: Lab
|
||||||
ns_os_version: CentOS 7
|
ns_os_version: CentOS 7
|
||||||
ns_hardware_platform: Lenovo T61
|
ns_hardware_platform: Lenovo T61
|
||||||
|
@ -199,15 +212,19 @@ class HostIPAClient(IPAClient):
|
||||||
return self._post_json(method='host_disable', name=name)
|
return self._post_json(method='host_disable', name=name)
|
||||||
|
|
||||||
|
|
||||||
def get_host_dict(description=None, force=None, ip_address=None, ns_host_location=None, ns_hardware_platform=None,
|
def get_host_dict(description=None, userclass=None, force=None, ip_address=None, l=None, ns_host_location=None, ns_hardware_platform=None,
|
||||||
ns_os_version=None, user_certificate=None, mac_address=None, random_password=None):
|
ns_os_version=None, user_certificate=None, mac_address=None, random_password=None):
|
||||||
data = {}
|
data = {}
|
||||||
if description is not None:
|
if description is not None:
|
||||||
data['description'] = description
|
data['description'] = description
|
||||||
|
if userclass is not None:
|
||||||
|
data['userclass'] = userclass
|
||||||
if force is not None:
|
if force is not None:
|
||||||
data['force'] = force
|
data['force'] = force
|
||||||
if ip_address is not None:
|
if ip_address is not None:
|
||||||
data['ip_address'] = ip_address
|
data['ip_address'] = ip_address
|
||||||
|
if l is not None:
|
||||||
|
data['l'] = l
|
||||||
if ns_host_location is not None:
|
if ns_host_location is not None:
|
||||||
data['nshostlocation'] = ns_host_location
|
data['nshostlocation'] = ns_host_location
|
||||||
if ns_hardware_platform is not None:
|
if ns_hardware_platform is not None:
|
||||||
|
@ -241,8 +258,10 @@ def ensure(module, client):
|
||||||
|
|
||||||
ipa_host = client.host_find(name=name)
|
ipa_host = client.host_find(name=name)
|
||||||
module_host = get_host_dict(description=module.params['description'],
|
module_host = get_host_dict(description=module.params['description'],
|
||||||
|
userclass=module.params['userclass'],
|
||||||
force=module.params['force'],
|
force=module.params['force'],
|
||||||
ip_address=module.params['ip_address'],
|
ip_address=module.params['ip_address'],
|
||||||
|
l=module.params['l'],
|
||||||
ns_host_location=module.params['ns_host_location'],
|
ns_host_location=module.params['ns_host_location'],
|
||||||
ns_hardware_platform=module.params['ns_hardware_platform'],
|
ns_hardware_platform=module.params['ns_hardware_platform'],
|
||||||
ns_os_version=module.params['ns_os_version'],
|
ns_os_version=module.params['ns_os_version'],
|
||||||
|
@ -294,9 +313,11 @@ def main():
|
||||||
fqdn=dict(type='str', required=True, aliases=['name']),
|
fqdn=dict(type='str', required=True, aliases=['name']),
|
||||||
force=dict(type='bool'),
|
force=dict(type='bool'),
|
||||||
ip_address=dict(type='str'),
|
ip_address=dict(type='str'),
|
||||||
|
l=dict(type='str', aliases=['locality']),
|
||||||
ns_host_location=dict(type='str', aliases=['nshostlocation']),
|
ns_host_location=dict(type='str', aliases=['nshostlocation']),
|
||||||
ns_hardware_platform=dict(type='str', aliases=['nshardwareplatform']),
|
ns_hardware_platform=dict(type='str', aliases=['nshardwareplatform']),
|
||||||
ns_os_version=dict(type='str', aliases=['nsosversion']),
|
ns_os_version=dict(type='str', aliases=['nsosversion']),
|
||||||
|
userclass=dict(type='str'),
|
||||||
user_certificate=dict(type='list', aliases=['usercertificate'], elements='str'),
|
user_certificate=dict(type='list', aliases=['usercertificate'], elements='str'),
|
||||||
mac_address=dict(type='list', aliases=['macaddress'], elements='str'),
|
mac_address=dict(type='list', aliases=['macaddress'], elements='str'),
|
||||||
update_dns=dict(type='bool'),
|
update_dns=dict(type='bool'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue