Skip to content
Snippets Groups Projects
Commit 41e8226d authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

Return the zone_name when adding a zone with name_from_ip.

When adding a zone using the option name_from_ip, the user have
little control over the final name of the zone, and if this name
is to be used in further processing in a playbook it might lead to
errors if the inferred name does not match what the user wanted to.

By returning the actual inferred zone name, the name can be safely
used for other tasks in the playbook.
parent 531e544b
Branches
Tags
No related merge requests found
...@@ -190,6 +190,17 @@ Variable | Description | Required ...@@ -190,6 +190,17 @@ Variable | Description | Required
`skip_nameserver_check` | Force DNS zone creation even if nameserver is not resolvable | no `skip_nameserver_check` | Force DNS zone creation even if nameserver is not resolvable | no
Return Values
=============
ipadnszone
----------
Variable | Description | Returned When
-------- | ----------- | -------------
`dnszone` | DNS Zone dict with zone name infered from `name_from_ip`. <br>Options: | If `state` is `present`, `name_from_ip` is used, and a zone was created.
&nbsp; | `name` - The name of the zone created, inferred from `name_from_ip`. | Always
Authors Authors
======= =======
......
...@@ -7,4 +7,9 @@ ...@@ -7,4 +7,9 @@
- name: Ensure zone exist, finding zone name from IP address. - name: Ensure zone exist, finding zone name from IP address.
ipadnszone: ipadnszone:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name_from_ip: 10.1.2.3 name_from_ip: 10.1.2.3/24
register: result
- name: Zone name inferred from `name_from_ip`
debug:
msg: "Zone created: {{ result.dnszone.name }}"
...@@ -192,6 +192,14 @@ EXAMPLES = """ ...@@ -192,6 +192,14 @@ EXAMPLES = """
""" """
RETURN = """ RETURN = """
dnszone:
description: DNS Zone dict with zone name infered from `name_from_ip`.
returned:
If `state` is `present`, `name_from_ip` is used, and a zone was created.
options:
name:
description: The name of the zone created, inferred from `name_from_ip`.
returned: always
""" """
from ipapython.dnsutil import DNSName # noqa: E402 from ipapython.dnsutil import DNSName # noqa: E402
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment