mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-08-01 20:34:41 +00:00
ipaclient role: Fix naming of modules, action_plugins and registered vars
The naming in the ipaclient role has not been following the naming scheme and conventions used in the ipaserver and ipareplica roles. Also registered results of modules and commands have not been unsing the result_ prefix as in the other roles. All this has been fixed and the naming is consistent now. These are the renames: ipahost -> ipaclient_get_otp ipaapi -> ipaclient_api ipaextras -> ipaclient_extras ipafixca -> ipaclient_fix_ca ipafstore -> ipaclient_fstore ipa_facts -> ipaclient_get_facts ipahost -> ipaclient_get_otp ipajoin -> ipaclient_join ipanss -> ipaclient_setup_nss ipasssd -> ipaclient_setup_sssd ipadiscovery -> ipaclient_test ipatest -> ipaclient_test_keytab
This commit is contained in:
@@ -28,7 +28,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipaapi
|
||||
module: ipaclient_api
|
||||
short description: Create temporary NSS database, call IPA API for remaining enrollment parts
|
||||
description:
|
||||
Create temporary NSS database, call IPA API for remaining enrollment parts
|
||||
@@ -50,11 +50,11 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: IPA API calls for remaining enrollment parts
|
||||
ipaapi:
|
||||
ipaclient_api:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
hostname: client1.example.com
|
||||
register: ipaapi
|
||||
register: result_ipaclient_api
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
@@ -30,7 +30,7 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipaextras
|
||||
module: ipaclient_extras
|
||||
short description: Configure IPA extras
|
||||
description:
|
||||
Configure IPA extras
|
||||
@@ -106,7 +106,7 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: IPA extras configurations
|
||||
ipaextras:
|
||||
ipaclient_extras:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
'''
|
||||
@@ -28,7 +28,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipafixca
|
||||
module: ipaclient_fix_ca
|
||||
short description: Fix IPA ca certificate
|
||||
description:
|
||||
Repair Fix IPA ca certificate
|
||||
@@ -54,7 +54,7 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Fix IPA ca certificate
|
||||
ipafixca:
|
||||
ipaclient_fix_ca:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
realm: EXAMPLE.COM
|
||||
basedn: dc=example,dc=com
|
||||
@@ -30,7 +30,7 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: fstore
|
||||
module: ipaclient_fstore
|
||||
short description: Backup files using IPA client sysrestore
|
||||
description:
|
||||
Backup files using IPA client sysrestore
|
||||
@@ -44,7 +44,7 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Backup /etc/krb5.conf
|
||||
ipafstore:
|
||||
ipaclient_fstore:
|
||||
backup: "/etc/krb5.conf"
|
||||
'''
|
||||
|
||||
@@ -136,7 +136,7 @@ def main():
|
||||
# The module does not change anything, meaning that
|
||||
# check mode is supported
|
||||
|
||||
ipa_facts = dict(
|
||||
facts = dict(
|
||||
packages= dict(
|
||||
ipalib=HAS_IPALIB,
|
||||
ipaserver=HAS_IPASERVER,
|
||||
@@ -153,23 +153,23 @@ def main():
|
||||
|
||||
if HAS_IPALIB:
|
||||
if is_client_configured():
|
||||
ipa_facts['configured']['client'] = True
|
||||
facts['configured']['client'] = True
|
||||
|
||||
ipa_facts['version'] = get_ipa_version()
|
||||
facts['version'] = get_ipa_version()
|
||||
for key,value in six.iteritems(get_ipa_conf()):
|
||||
ipa_facts[key] = value
|
||||
facts[key] = value
|
||||
|
||||
if HAS_IPASERVER:
|
||||
if is_server_configured():
|
||||
ipa_facts['configured']['server'] = True
|
||||
ipa_facts['configured']['dns'] = is_dns_configured()
|
||||
ipa_facts['configured']['ca'] = is_ca_configured()
|
||||
ipa_facts['configured']['kra'] = is_kra_configured()
|
||||
ipa_facts['configured']['ntpd'] = is_ntpd_configured()
|
||||
facts['configured']['server'] = True
|
||||
facts['configured']['dns'] = is_dns_configured()
|
||||
facts['configured']['ca'] = is_ca_configured()
|
||||
facts['configured']['kra'] = is_kra_configured()
|
||||
facts['configured']['ntpd'] = is_ntpd_configured()
|
||||
|
||||
module.exit_json(
|
||||
changed=False,
|
||||
ansible_facts=dict(ipa=ipa_facts)
|
||||
ansible_facts=dict(ipa=facts)
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -26,7 +26,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.0',
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipahost
|
||||
module: ipaclient_get_otp
|
||||
short description: Manage IPA hosts
|
||||
description:
|
||||
Manage hosts in a IPA domain.
|
||||
@@ -84,28 +84,28 @@ author:
|
||||
EXAMPLES = '''
|
||||
# Example from Ansible Playbooks
|
||||
# Add a new host with a random OTP, authenticate using principal/password
|
||||
- ipahost:
|
||||
- ipaclient_get_otp:
|
||||
principal: admin
|
||||
password: MySecretPassword
|
||||
fqdn: ipaclient.ipa.domain.com
|
||||
ipaddress: 192.168.100.23
|
||||
random: True
|
||||
register: ipahost
|
||||
register: result_ipaclient_get_otp
|
||||
|
||||
# Add a new host, authenticate with a keytab stored on the controller node
|
||||
- ipahost:
|
||||
- ipaclient_get_otp:
|
||||
keytab: admin.keytab
|
||||
fqdn: ipaclient.ipa.domain.com
|
||||
|
||||
# Remove a host, authenticate using principal/password
|
||||
- ipahost:
|
||||
- ipaclient_get_otp:
|
||||
principal: admin
|
||||
password: MySecretPassword
|
||||
fqdn: ipaclient.ipa.domain.com
|
||||
state: absent
|
||||
|
||||
# Modify a host, add ssh public key:
|
||||
- ipahost:
|
||||
- ipaclient_get_otp:
|
||||
principal: admin
|
||||
password: MySecretPassword
|
||||
fqdn: ipaclient.ipa.domain.com
|
||||
@@ -355,7 +355,7 @@ def main():
|
||||
changed = ensure_host_absent(module, api, host)
|
||||
|
||||
except Exception as e:
|
||||
module.fail_json(msg="ipahost module failed : %s" % str(e))
|
||||
module.fail_json(msg="ipaclient_get_otp module failed : %s" % str(e))
|
||||
finally:
|
||||
run([paths.KDESTROY], raiseonerr=False, env=os.environ)
|
||||
|
||||
@@ -30,7 +30,7 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipajoin
|
||||
module: ipaclient_join
|
||||
short description: Join a machine to an IPA realm and get a keytab for the host service principal
|
||||
description:
|
||||
Join a machine to an IPA realm and get a keytab for the host service principal
|
||||
@@ -88,7 +88,7 @@ author:
|
||||
EXAMPLES = '''
|
||||
# Join IPA to get the keytab
|
||||
- name: Join IPA in force mode with maximum 5 kinit attempts
|
||||
ipajoin:
|
||||
ipaclient_join:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
realm: EXAMPLE.COM
|
||||
@@ -102,7 +102,7 @@ EXAMPLES = '''
|
||||
|
||||
# Join IPA to get the keytab using ipadiscovery return values
|
||||
- name: Join IPA
|
||||
ipajoin:
|
||||
ipaclient_join:
|
||||
servers: "{{ ipadiscovery.servers }}"
|
||||
domain: "{{ ipadiscovery.domain }}"
|
||||
realm: "{{ ipadiscovery.realm }}"
|
||||
@@ -30,8 +30,8 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipanss
|
||||
short description: Create IPA NSS database
|
||||
module: ipaclient_setup_nss
|
||||
short description: Create IPA client NSS database
|
||||
description:
|
||||
Create IPA NSS database
|
||||
options:
|
||||
@@ -77,8 +77,8 @@ author:
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Create IPA NSS database
|
||||
ipanss:
|
||||
- name: Create IPA client NSS database
|
||||
ipaclient_setup_nss:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
realm: EXAMPLE.COM
|
||||
@@ -30,10 +30,10 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: sssd_conf
|
||||
short description: Configure sssd
|
||||
module: ipaclient_setup_sssd
|
||||
short description: Configure sssd for IPA client
|
||||
description:
|
||||
Configure sssd
|
||||
Configure sssd for IPA client
|
||||
options:
|
||||
servers:
|
||||
description: The FQDN of the IPA servers to connect to.
|
||||
@@ -93,7 +93,7 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Configure SSSD
|
||||
sssd:
|
||||
ipaclient_setup_sssd:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
realm: EXAMPLE.COM
|
||||
@@ -30,7 +30,7 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipadiscovery
|
||||
module: ipaclient_test
|
||||
short description: Tries to discover IPA server
|
||||
description:
|
||||
Tries to discover IPA server using DNS or host name
|
||||
@@ -85,34 +85,34 @@ author:
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Complete autodiscovery, register return values as ipadiscovery
|
||||
# Complete autodiscovery, register return values as ipaclient_test
|
||||
- name: IPA discovery
|
||||
ipadiscovery:
|
||||
register: ipadiscovery
|
||||
ipaclient_test:
|
||||
register: register_ipaclient_test
|
||||
|
||||
# Discovery using servers, register return values as ipadiscovery
|
||||
# Discovery using servers, register return values as ipaclient_test
|
||||
- name: IPA discovery
|
||||
ipadiscovery:
|
||||
ipaclient_test:
|
||||
servers: server1.domain.com,server2.domain.com
|
||||
register: ipadiscovery
|
||||
register: register_ipaclient_test
|
||||
|
||||
# Discovery using domain name, register return values as ipadiscovery
|
||||
# Discovery using domain name, register return values as ipaclient_test
|
||||
- name: IPA discovery
|
||||
ipadiscovery:
|
||||
ipaclient_test:
|
||||
domain: domain.com
|
||||
register: ipadiscovery
|
||||
register: register_ipaclient_test
|
||||
|
||||
# Discovery using realm, register return values as ipadiscovery
|
||||
# Discovery using realm, register return values as ipaclient_test
|
||||
- name: IPA discovery
|
||||
ipadiscovery:
|
||||
ipaclient_test:
|
||||
realm: DOMAIN.COM
|
||||
register: ipadiscovery
|
||||
register: register_ipaclient_test
|
||||
|
||||
# Discovery using hostname, register return values as ipadiscovery
|
||||
# Discovery using hostname, register return values as ipaclient_test
|
||||
- name: IPA discovery
|
||||
ipadiscovery:
|
||||
ipaclient_test:
|
||||
hostname: host.domain.com
|
||||
register: ipadiscovery
|
||||
register: register_ipaclient_test
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
@@ -30,7 +30,7 @@ ANSIBLE_METADATA = {
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ipatest
|
||||
module: ipaclient_test_keytab
|
||||
short description: Test if the krb5.keytab on the machine is valid and can be used.
|
||||
description:
|
||||
Test if the krb5.keytab on the machine is valid and can be used.
|
||||
@@ -64,7 +64,7 @@ author:
|
||||
EXAMPLES = '''
|
||||
# Test IPA with local keytab
|
||||
- name: Test IPA in force mode with maximum 5 kinit attempts
|
||||
ipatest:
|
||||
ipaclient_test_keytab:
|
||||
servers: ["server1.example.com","server2.example.com"]
|
||||
domain: example.com
|
||||
realm: EXAMPLE.COM
|
||||
@@ -74,7 +74,7 @@ EXAMPLES = '''
|
||||
|
||||
# Test IPA with ipadiscovery return values
|
||||
- name: Join IPA
|
||||
ipajoin:
|
||||
ipaclient_test_keytab:
|
||||
servers: "{{ ipadiscovery.servers }}"
|
||||
domain: "{{ ipadiscovery.domain }}"
|
||||
realm: "{{ ipadiscovery.realm }}"
|
||||
@@ -94,7 +94,7 @@ krb5_conf_ok:
|
||||
description: The flag describes if krb5.conf on the host is usable.
|
||||
returned: always
|
||||
type: bool
|
||||
ipa_test_ok:
|
||||
ping_test_ok:
|
||||
description: The flag describes if ipa ping test succeded.
|
||||
returned: always
|
||||
type: bool
|
||||
@@ -143,7 +143,7 @@ def main():
|
||||
|
||||
krb5_keytab_ok = False
|
||||
krb5_conf_ok = False
|
||||
ipa_test_ok = False
|
||||
ping_test_ok = False
|
||||
ca_crt_exists = os.path.exists(paths.IPA_CA_CRT)
|
||||
env = {'PATH': SECURE_PATH, 'KRB5CCNAME': paths.IPA_DNS_CCACHE}
|
||||
|
||||
@@ -160,7 +160,7 @@ def main():
|
||||
try:
|
||||
result = run(["/usr/bin/ipa", "ping"], raiseonerr=False, env=env)
|
||||
if result.returncode == 0:
|
||||
ipa_test_ok = True
|
||||
ping_test_ok = True
|
||||
except OSError:
|
||||
pass
|
||||
except GSSError as e:
|
||||
@@ -197,7 +197,7 @@ def main():
|
||||
result = run(["/usr/bin/ipa", "ping"], raiseonerr=False,
|
||||
env=env)
|
||||
if result.returncode == 0:
|
||||
ipa_test_ok = True
|
||||
ping_test_ok = True
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
@@ -214,7 +214,7 @@ def main():
|
||||
krb5_keytab_ok=krb5_keytab_ok,
|
||||
krb5_conf_ok=krb5_conf_ok,
|
||||
ca_crt_exists=ca_crt_exists,
|
||||
ipa_test_ok=ipa_test_ok)
|
||||
ping_test_ok=ping_test_ok)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user