community.general.clc_publicip (8.5.0) — module

Add and Delete public ips on servers 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 add or delete public ip addresses on an existing server or servers 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: Add Public IP to Server
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: Create Public IP For Servers
      community.general.clc_publicip:
        protocol: TCP
        ports:
          - 80
        server_ids:
          - UC1TEST-SVR01
          - UC1TEST-SVR02
        state: present
      register: clc

    - name: Debug
      ansible.builtin.debug:
        var: clc
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete Public IP from Server
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: Create Public IP For Servers
      community.general.clc_publicip:
        server_ids:
          - UC1TEST-SVR01
          - UC1TEST-SVR02
        state: absent
      register: clc

    - name: Debug
      ansible.builtin.debug:
        var: clc

Inputs

    
wait:
    default: true
    description:
    - Whether to wait for the tasks to finish before returning.
    type: bool

ports:
    description:
    - A list of ports to expose. This is required when state is 'present'
    elements: int
    type: list

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Determine whether to create or delete public IPs. If present module will not create
      a second public ip if one already exists.
    type: str

protocol:
    choices:
    - TCP
    - UDP
    - ICMP
    default: TCP
    description:
    - The protocol that the public IP will listen for.
    type: str

server_ids:
    description:
    - A list of servers to create public ips on.
    elements: str
    required: true
    type: list

Outputs

server_ids:
  description: The list of server ids that are changed
  returned: success
  sample:
  - UC1TEST-SVR01
  - UC1TEST-SVR02
  type: list