solace.pubsub_plus.solace_cloud_service_hostname (1.12.2) — module

manage service hostnames

Authors: Ricardo Gomez-Ulmke (@rjgu)

preview | supported by community

Install collection

Install with ansible-galaxy collection install solace.pubsub_plus:==1.12.2


Add to requirements.yml

  collections:
    - name: solace.pubsub_plus
      version: 1.12.2

Description

Add & delete additional hostnames on a Solace Cloud service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Copyright (c) 2022, Solace Corporation, Ricardo Gomez-Ulmke, <ricardo.gomez-ulmke@solace.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

-
  name: solace_cloud_service_hostnames doc example
  hosts: all
  gather_facts: no
  any_errors_fatal: true
  collections:
    - solace.pubsub_plus
  module_defaults:
    solace.pubsub_plus.solace_cloud_get_service_hostnames:
      solace_cloud_api_token: "{{ SOLACE_CLOUD_API_TOKEN if broker_type=='solace_cloud' else omit }}"
      solace_cloud_service_id: "{{ solace_cloud_service_id | default(omit) }}"
    solace.pubsub_plus.solace_cloud_service_hostname:
      solace_cloud_api_token: "{{ SOLACE_CLOUD_API_TOKEN if broker_type=='solace_cloud' else omit }}"
      solace_cloud_service_id: "{{ solace_cloud_service_id | default(omit) }}"
  tasks:

    - name: exit if not solace cloud
      meta: end_play
      when: broker_type != 'solace_cloud'

    - set_fact:
        additionalHostnames:
        - hostname-1
        - hostname-2

    - name: ensure all hostnames in list are absent
      solace_cloud_service_hostname:
        hostname: "{{ item }}"
        state: absent
      loop: "{{ additionalHostnames }}"

    - name: add all hostnames in list
      solace_cloud_service_hostname:
        hostname: "{{ item }}"
        state: present
      loop: "{{ additionalHostnames }}"

    - name: get list of existing hostnames
      solace_cloud_get_service_hostnames:

    - name: ensure all hostnames in list are absent
      solace_cloud_service_hostname:
        hostname: "{{ item }}"
        state: absent
      loop: "{{ additionalHostnames }}"

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description: Target state.
    required: false
    type: str

timeout:
    default: 60
    description: Connection timeout in seconds for the http request or overall call interaction
      timeout for Solace Cloud API.
    required: false
    type: int

hostname:
    description:
    - The additional hostname on the service to manage.
    required: true
    type: str

access_type:
    choices:
    - public
    - private
    default: public
    description:
    - The access type for the hostname.
    required: false
    type: str

validate_certs:
    default: true
    description: Flag to switch validation of client certificates on/off when using a
      secure connection.
    required: false
    type: bool

solace_cloud_home:
    choices:
    - us
    - au
    - US
    - AU
    - ''
    description: The Solace Cloud home region.
    required: false
    type: str

solace_cloud_api_token:
    aliases:
    - api_token
    description:
    - The API Token.
    - Generate using Solace Cloud console with the appropriate permissions for the operations
      you want to enable.
    required: true
    type: str

solace_cloud_service_id:
    aliases:
    - service_id
    description:
    - The service id of a service in Solace Cloud.
    - Click on the service in Solace Cloud - the service id is in the URL.
    required: true
    type: str

Outputs

msg:
  description: error message if not ok
  returned: error
  type: str
rc:
  description: Return code. rc=0 on success, rc=1 on error.
  returned: always
  sample:
    error:
      rc: 1
    success:
      rc: 0
  type: int
response:
  description: response from the Api call.
  returned: success
  sample:
    msg: null
    rc: 0
    response:
      adminProgress: completed
      creationTimestamp: 0
      id: 3icn47vcsgg
      operation: create
      serviceHostName: hostname-1
      type: serviceHostNameRequest
  type: dict

See also