community.general.utm_dns_host (8.5.0) — module

Create, update or destroy dns entry in Sophos UTM

Authors: Johannes Brunswicker (@MatrixCrawler)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Create, update or destroy a dns entry in SOPHOS UTM.

This module needs to have the REST Ability of the UTM to be activated.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create UTM dns host entry
  community.general.utm_dns_host:
    utm_host: sophos.host.name
    utm_token: abcdefghijklmno1234
    name: TestDNSEntry
    hostname: testentry.some.tld
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove UTM dns host entry
  community.general.utm_dns_host:
    utm_host: sophos.host.name
    utm_token: abcdefghijklmno1234
    name: TestDNSEntry
    state: absent

Inputs

    
name:
    description:
    - The name of the object. Will be used to identify the entry
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - The desired state of the object.
    - V(present) will create or update an object.
    - V(absent) will delete an object if it was present.
    type: str

address:
    default: 0.0.0.0
    description:
    - The IPV4 Address of the entry. Can be left empty for automatic resolving.
    type: str

comment:
    default: ''
    description:
    - An optional comment to add to the dns host object
    type: str

headers:
    default: {}
    description:
    - A dictionary of additional headers to be sent to POST and PUT requests.
    - Is needed for some modules.
    required: false
    type: dict

timeout:
    default: 0
    description:
    - the timeout for the utm to resolve the ip address for the hostname again
    type: int

address6:
    default: '::'
    description:
    - The IPV6 Address of the entry. Can be left empty for automatic resolving.
    type: str

hostname:
    description:
    - The hostname for the dns host object
    type: str

resolved:
    default: false
    description:
    - whether the hostname's ipv4 address is already resolved or not
    type: bool

utm_host:
    description:
    - The REST Endpoint of the Sophos UTM.
    required: true
    type: str

utm_port:
    default: 4444
    description:
    - The port of the REST interface.
    type: int

interface:
    default: ''
    description:
    - The reference name of the interface to use. If not provided the default interface
      will be used
    type: str

resolved6:
    default: false
    description:
    - whether the hostname's ipv6 address is already resolved or not
    type: bool

utm_token:
    description:
    - The token used to identify at the REST-API. See U(https://www.sophos.com/en-us/medialibrary/PDFs/documentation/UTMonAWS/Sophos-UTM-RESTful-API.pdf?la=en),
      Chapter 2.4.2.
    required: true
    type: str

utm_protocol:
    choices:
    - http
    - https
    default: https
    description:
    - The protocol of the REST Endpoint.
    type: str

validate_certs:
    default: true
    description:
    - Whether the REST interface's ssl certificate should be verified or not.
    type: bool

Outputs

result:
  contains:
    _locked:
      description: Whether or not the object is currently locked
      type: bool
    _ref:
      description: The reference name of the object
      type: str
    address:
      description: The ipv4 address of the object
      type: str
    address6:
      description: The ipv6 address of the object
      type: str
    comment:
      description: The comment string
      type: str
    hostname:
      description: The hostname of the object
      type: str
    interface:
      description: The reference name of the interface the object is associated with
      type: str
    name:
      description: The name of the object
      type: str
    resolved:
      description: Whether the ipv4 address is resolved or not
      type: bool
    resolved6:
      description: Whether the ipv6 address is resolved or not
      type: bool
    timeout:
      description: The timeout until a new resolving will be attempted
      type: int
  description: The utm object that was created
  returned: success
  type: complex