community.general.clc_loadbalancer (8.5.0) — module

Create, Delete shared loadbalancers in CenturyLink Cloud

Authors: CLC Runner (@clc-runner)

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

An Ansible module to Create, Delete shared loadbalancers in CenturyLink Cloud.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Note - You must set the CLC_V2_API_USERNAME And CLC_V2_API_PASSWD Environment variables before running these examples
- name: Create Loadbalancer
  hosts: localhost
  connection: local
  tasks:
    - name: Actually Create things
      community.general.clc_loadbalancer:
        name: test
        description: test
        alias: TEST
        location: WA1
        port: 443
        nodes:
          - ipAddress: 10.11.22.123
            privatePort: 80
        state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add node to an existing loadbalancer pool
  hosts: localhost
  connection: local
  tasks:
    - name: Actually Create things
      community.general.clc_loadbalancer:
        name: test
        description: test
        alias: TEST
        location: WA1
        port: 443
        nodes:
          - ipAddress: 10.11.22.234
            privatePort: 80
        state: nodes_present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove node from an existing loadbalancer pool
  hosts: localhost
  connection: local
  tasks:
    - name: Actually Create things
      community.general.clc_loadbalancer:
        name: test
        description: test
        alias: TEST
        location: WA1
        port: 443
        nodes:
          - ipAddress: 10.11.22.234
            privatePort: 80
        state: nodes_absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete LoadbalancerPool
  hosts: localhost
  connection: local
  tasks:
    - name: Actually Delete things
      community.general.clc_loadbalancer:
        name: test
        description: test
        alias: TEST
        location: WA1
        port: 443
        nodes:
          - ipAddress: 10.11.22.123
            privatePort: 80
        state: port_absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete Loadbalancer
  hosts: localhost
  connection: local
  tasks:
    - name: Actually Delete things
      community.general.clc_loadbalancer:
        name: test
        description: test
        alias: TEST
        location: WA1
        port: 443
        nodes:
          - ipAddress: 10.11.22.123
            privatePort: 80
        state: absent

Inputs

    
name:
    description:
    - The name of the loadbalancer
    required: true
    type: str

port:
    choices:
    - '80'
    - '443'
    description:
    - Port to configure on the public-facing side of the load balancer pool
    type: str

alias:
    description:
    - The alias of your CLC Account
    required: true
    type: str

nodes:
    default: []
    description:
    - A list of nodes that needs to be added to the load balancer pool
    elements: dict
    type: list

state:
    choices:
    - present
    - absent
    - port_absent
    - nodes_present
    - nodes_absent
    default: present
    description:
    - Whether to create or delete the load balancer pool
    type: str

method:
    choices:
    - leastConnection
    - roundRobin
    description: -The balancing method for the load balancer pool
    type: str

status:
    choices:
    - enabled
    - disabled
    default: enabled
    description:
    - The status of the loadbalancer
    type: str

location:
    description:
    - The location of the datacenter where the load balancer resides in
    required: true
    type: str

description:
    description:
    - A description for the loadbalancer
    type: str

persistence:
    choices:
    - standard
    - sticky
    description:
    - The persistence method for the load balancer
    type: str

Outputs

loadbalancer:
  description: The load balancer result object from CLC
  returned: success
  sample:
    description: test-lb
    id: ab5b18cb81e94ab9925b61d1ca043fb5
    ipAddress: 66.150.174.197
    links:
    - href: /v2/sharedLoadBalancers/wfad/wa1/ab5b18cb81e94ab9925b61d1ca043fb5
      rel: self
      verbs:
      - GET
      - PUT
      - DELETE
    - href: /v2/sharedLoadBalancers/wfad/wa1/ab5b18cb81e94ab9925b61d1ca043fb5/pools
      rel: pools
      verbs:
      - GET
      - POST
    name: test-lb
    pools: []
    status: enabled
  type: dict