haproxy/plugins/modules/opnsense_unbound_override_alias.py
2023-06-13 23:27:01 +02:00

101 lines
2.2 KiB
Python

DOCUMENTATION = '''
---
module: opnsense_dns_alias
short_description: Ansible action plugin for managing DNS aliases in OPNsense.
description:
- This Ansible action plugin interacts with the OPNsense API to manage DNS aliases.
version_added: "2.9"
requirements:
- Ansible 2.9 or later
- Python 2.7 or later
- The `requests` library for Python (`pip install requests`)
options:
opnsense_url:
description:
- The URL of the OPNsense instance.
required: true
type: str
attributes:
- configurable
api_key:
description:
- The API key for authentication.
required: true
type: str
attributes:
- no_log
api_secret:
description:
- The API secret for authentication.
required: true
type: str
attributes:
- no_log
override_id:
description:
- The ID of the host override.
required: true
type: int
alias_host:
description:
- The hostname for the alias.
required: true
type: str
alias_domain:
description:
- The domain for the alias.
required: true
type: str
state:
description:
- The desired state of the DNS alias.
default: "present"
choices: ["present", "absent"]
type: str
'''
EXAMPLES = '''
- name: Add DNS alias
opnsense_dns_alias:
opnsense_url: http://your-opnsense-ip
api_key: your-api-key
api_secret: your-api-secret
override_id: 123
alias_host: alias-host
alias_domain: alias-domain
state: present
register: result
- name: Remove DNS alias
opnsense_dns_alias:
opnsense_url: http://your-opnsense-ip
api_key: your-api-key
api_secret: your-api-secret
override_id: 123
alias_host: alias-host
alias_domain: alias-domain
state: absent
register: result
'''
RETURN = '''
changed:
description: Indicates whether the DNS alias was changed.
type: bool
api_response:
description: The response from the OPNsense API.
type: dict
failed:
description: Indicates whether the task failed.
type: bool
msg:
description: An error message if the task failed.
type: str
status_code:
description: The HTTP status code of the API response.
type: int
body:
description: The JSON body of the API response.
type: dict
'''