Skip to content

Commit

Permalink
FreeIPA: Fix documentation (ansible#66194)
Browse files Browse the repository at this point in the history
* Add datatype whereever it is missing
* Fix documentation

Signed-off-by: Abhijeet Kasurde <[email protected]>
  • Loading branch information
Akasurde authored Jan 9, 2020
1 parent 70bc351 commit 42b0c96
Show file tree
Hide file tree
Showing 17 changed files with 358 additions and 254 deletions.
16 changes: 9 additions & 7 deletions lib/ansible/modules/identity/ipa/ipa_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'supported_by': 'community'}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: ipa_config
author: Fran Fitzpatrick (@fxfitz)
Expand All @@ -22,30 +22,32 @@
ipadefaultloginshell:
description: Default shell for new users.
aliases: ["loginshell"]
type: str
ipadefaultemaildomain:
description: Default e-mail domain for new users.
aliases: ["emaildomain"]
type: str
extends_documentation_fragment: ipa.documentation
version_added: "2.7"
'''

EXAMPLES = '''
# Ensure the default login shell is bash.
- ipa_config:
EXAMPLES = r'''
- name: Ensure the default login shell is bash.
ipa_config:
ipadefaultloginshell: /bin/bash
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
# Ensure the default e-mail domain is ansible.com.
- ipa_config:
- name: Ensure the default e-mail domain is ansible.com.
ipa_config:
ipadefaultemaildomain: ansible.com
ipa_host: localhost
ipa_user: admin
ipa_pass: supersecret
'''

RETURN = '''
RETURN = r'''
config:
description: Configuration as returned by IPA API.
returned: always
Expand Down
44 changes: 25 additions & 19 deletions lib/ansible/modules/identity/ipa/ipa_dnsrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: ipa_dnsrecord
author: Abhijeet Kasurde (@Akasurde)
Expand All @@ -26,11 +26,13 @@
description:
- The DNS zone name to which DNS record needs to be managed.
required: true
type: str
record_name:
description:
- The DNS record name to manage.
required: true
aliases: ["name"]
type: str
record_type:
description:
- The type of DNS record name.
Expand All @@ -39,7 +41,8 @@
- "'SRV' and 'MX' are added in version 2.8."
required: false
default: 'A'
choices: ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV', 'MX']
choices: ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'MX', 'PTR', 'SRV', 'TXT']
type: str
record_value:
description:
- Manage DNS record name with this value.
Expand All @@ -52,24 +55,27 @@
- In the case of 'SRV' record type, this will be a service record.
- In the case of 'MX' record type, this will be a mail exchanger record.
required: true
type: str
record_ttl:
description:
- Set the TTL for the record.
- Applies only when adding a new or changing the value of record_value.
version_added: "2.7"
required: false
type: int
state:
description: State to ensure
required: false
default: present
choices: ["present", "absent"]
choices: ["absent", "present"]
type: str
extends_documentation_fragment: ipa.documentation
version_added: "2.4"
'''

EXAMPLES = '''
# Ensure dns record is present
- ipa_dnsrecord:
EXAMPLES = r'''
- name: Ensure dns record is present
ipa_dnsrecord:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
Expand All @@ -78,8 +84,8 @@
record_type: 'AAAA'
record_value: '::1'
# Ensure that dns record exists with a TTL
- ipa_dnsrecord:
- name: Ensure that dns record exists with a TTL
ipa_dnsrecord:
name: host02
zone_name: example.com
record_type: 'AAAA'
Expand All @@ -89,8 +95,8 @@
ipa_pass: topsecret
state: present
# Ensure a PTR record is present
- ipa_dnsrecord:
- name: Ensure a PTR record is present
ipa_dnsrecord:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
Expand All @@ -99,8 +105,8 @@
record_type: 'PTR'
record_value: 'internal.ipa.example.com'
# Ensure a TXT record is present
- ipa_dnsrecord:
- name: Ensure a TXT record is present
ipa_dnsrecord:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
Expand All @@ -109,8 +115,8 @@
record_type: 'TXT'
record_value: 'EXAMPLE.COM'
# Ensure an SRV record is present
- ipa_dnsrecord:
- name: Ensure an SRV record is present
ipa_dnsrecord:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
Expand All @@ -119,8 +125,8 @@
record_type: 'SRV'
record_value: '10 50 88 ipa.example.com'
# Ensure an MX record is present
- ipa_dnsrecord:
- name: Ensure an MX record is present
ipa_dnsrecord:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
Expand All @@ -129,8 +135,8 @@
record_type: 'MX'
record_value: '1 mailserver.example.com'
# Ensure that dns record is removed
- ipa_dnsrecord:
- name: Ensure that dns record is removed
ipa_dnsrecord:
name: host01
zone_name: example.com
record_type: 'AAAA'
Expand All @@ -141,7 +147,7 @@
state: absent
'''

RETURN = '''
RETURN = r'''
dnsrecord:
description: DNS record as returned by IPA API.
returned: always
Expand Down
23 changes: 13 additions & 10 deletions lib/ansible/modules/identity/ipa/ipa_dnszone.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'supported_by': 'community'}


DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: ipa_dnszone
author: Fran Fitzpatrick (@fxfitz)
Expand All @@ -24,47 +24,50 @@
description:
- The DNS zone name to which needs to be managed.
required: true
type: str
state:
description: State to ensure
required: false
default: present
choices: ["present", "absent"]
choices: ["absent", "present"]
type: str
dynamicupdate:
description: Apply dynamic update to zone
required: false
default: "false"
choices: ["false", "true"]
version_added: "2.9"
type: str
extends_documentation_fragment: ipa.documentation
version_added: "2.5"
'''

EXAMPLES = '''
# Ensure dns zone is present
- ipa_dnszone:
EXAMPLES = r'''
- name: Ensure dns zone is present
ipa_dnszone:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
zone_name: example.com
# Ensure dns zone is present and is dynamic update
- ipa_dnszone:
- name: Ensure dns zone is present and is dynamic update
ipa_dnszone:
ipa_host: spider.example.com
ipa_pass: Passw0rd!
state: present
zone_name: example.com
dynamicupdate: true
# Ensure that dns zone is removed
- ipa_dnszone:
- name: Ensure that dns zone is removed
ipa_dnszone:
zone_name: example.com
ipa_host: localhost
ipa_user: admin
ipa_pass: topsecret
state: absent
'''

RETURN = '''
RETURN = r'''
zone:
description: DNS zone as returned by IPA API.
returned: always
Expand Down
36 changes: 22 additions & 14 deletions lib/ansible/modules/identity/ipa/ipa_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'status': ['preview'],
'supported_by': 'community'}

DOCUMENTATION = '''
DOCUMENTATION = r'''
---
module: ipa_group
author: Thomas Krahn (@Nosmoht)
Expand All @@ -24,9 +24,11 @@
- Can not be changed as it is the unique identifier.
required: true
aliases: ['name']
type: str
description:
description:
- Description of the group.
type: str
external:
description:
- Allow adding external non-IPA members from trusted domains.
Expand All @@ -35,12 +37,15 @@
description:
- GID (use this option to set it manually).
aliases: ['gid']
type: str
group:
description:
- List of group names assigned to this group.
- If an empty list is passed all groups will be removed from this group.
- If option is omitted assigned groups will not be checked or changed.
- Groups that are already assigned but not passed will be removed.
type: list
elements: str
nonposix:
description:
- Create as a non-POSIX group.
Expand All @@ -51,27 +56,30 @@
- If an empty list is passed all users will be removed from this group.
- If option is omitted assigned users will not be checked or changed.
- Users that are already assigned but not passed will be removed.
type: list
elements: str
state:
description:
- State to ensure
default: "present"
choices: ["present", "absent"]
choices: ["absent", "present"]
type: str
extends_documentation_fragment: ipa.documentation
version_added: "2.3"
'''

EXAMPLES = '''
# Ensure group is present
- ipa_group:
EXAMPLES = r'''
- name: Ensure group is present
ipa_group:
name: oinstall
gidnumber: 54321
state: present
ipa_host: ipa.example.com
ipa_user: admin
ipa_pass: topsecret
# Ensure that groups sysops and appops are assigned to ops but no other group
- ipa_group:
- name: Ensure that groups sysops and appops are assigned to ops but no other group
ipa_group:
name: ops
group:
- sysops
Expand All @@ -80,8 +88,8 @@
ipa_user: admin
ipa_pass: topsecret
# Ensure that users linus and larry are assign to the group, but no other user
- ipa_group:
- name: Ensure that users linus and larry are assign to the group, but no other user
ipa_group:
name: sysops
user:
- linus
Expand All @@ -90,16 +98,16 @@
ipa_user: admin
ipa_pass: topsecret
# Ensure group is absent
- ipa_group:
- name: Ensure group is absent
ipa_group:
name: sysops
state: absent
ipa_host: ipa.example.com
ipa_user: admin
ipa_pass: topsecret
'''

RETURN = '''
RETURN = r'''
group:
description: Group as returned by IPA API
returned: always
Expand Down Expand Up @@ -228,10 +236,10 @@ def main():
description=dict(type='str'),
external=dict(type='bool'),
gidnumber=dict(type='str', aliases=['gid']),
group=dict(type='list'),
group=dict(type='list', elements='str'),
nonposix=dict(type='bool'),
state=dict(type='str', default='present', choices=['present', 'absent']),
user=dict(type='list'))
user=dict(type='list', elements='str'))

module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True,
Expand Down
Loading

0 comments on commit 42b0c96

Please sign in to comment.