steampunk.unit.listener (0.7.1) — module

Manage NGINX Unit listener

Authors: Tadej Borovšak (@tadeboro)

Install collection

Install with ansible-galaxy collection install steampunk.unit:==0.7.1


Add to requirements.yml

  collections:
    - name: steampunk.unit
      version: 0.7.1

Description

Manage NGINX Unit listener configuration.

Upstream docs are at U(https://unit.nginx.org/configuration/#listeners).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new listener (applications/test must exist)
  steampunk.unit.listener:
    pattern: "127.0.0.1:80"
    pass: applications/test
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new listener (certificate bundle must exist)
  steampunk.unit.listener:
    pattern: "127.0.0.1:80"
    pass: applications/test
    tls:
      certificate: bundle
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete listener
  steampunk.unit.listener:
    pattern: "*:3000"
    state: absent

Inputs

    
tls:
    description:
    - SSL/TLS configuration.
    suboptions:
      certificate:
        description:
        - Name of the certificate chain.
        - If the certificate chain is not already defined, module will report an error.
        type: str
    type: dict

pass:
    description:
    - Destination that should receive the incomming requests.
    - If the destination is not defined at the time of module's execution, module will
      abort the operation.
    - Required if I(state) is C(present).
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the manager resource.
    type: str

pattern:
    description:
    - A pattern that listener will listen to. Pattern also serves as an id that module
      uses to enforce state.
    required: true
    type: str

provider:
    description:
    - Connection parameters.
    suboptions:
      ca_path:
        description:
        - Path to the CA bundle that should be used to validate the backend certificate.
        - If this parameter is not set, module will use the CA bundle that python is using.
        - Can also be set using the  I(UNIT_CA_PATH) environment variable.
        type: path
      endpoint:
        description:
        - HTTP or UNIX uri that should be used to communicate with the Unit.
        - The uri B(MUST) be prefixed by either C(http://), C(https://), or C(unix://).
        - By default, modules will try to connect to I(unix:///var/run/unit/control.sock),
          and if this socket does not exist, fallback to I(unix:///var/run/control.unit.sock).
        - Can also be set using the I(UNIT_ENDPOINT) environment variable.
        type: str
      password:
        description:
        - Password that is used when the I(endpoint) is protected using the basic authentication.
        - This parameter is ignored when the I(enpoint) parameter points to an unix socket.
        - Value is masked in the logs.
        - Can also be set using the I(UNIT_ENDPOINT) environment variable.
        type: str
      username:
        description:
        - Username that is used when the I(enpoint) is protected using the basic authentication.
        - This parameter is ignored when the I(enpoint) parameter points to an unix socket.
        - Can also be set using the I(UNIT_ENDPOINT) environment variable.
        type: str
      verify:
        default: true
        description:
        - Flag that controls the certificate validation.
        - If you are using self-signed certificates, you can set this parameter to C(false).
        - ONLY USE THIS PARAMETER IN DEVELOPMENT SCENARIOS! In you use self-signed certificates
          in production, see the I(auth.ca_path) parameter.
        - Can also be set using the  I(UNIT_VERIFY) environment variable.
        type: bool
    type: dict

Outputs

object:
  contains:
    pass:
      description: Destination for incomming requests.
      returned: always
      sample: applications/test
      type: str
    pattern:
      description: Listener pattern.
      returned: always
      sample: 127.0.0.1:3000
      type: str
    tls:
      contains:
        certificate:
          description: Certificate bundle
          returned: always
          sample: certificates/my-bundle
          type: str
      description: SSL/TLS configuration
      returned: if set
      type: complex
  description: Object representing NGINX Unit listener.
  returned: On success and if I(state) == C(present)
  type: complex