community.general.oneandone_load_balancer (8.5.0) — module

Configure 1&1 load balancer

Authors: Amel Ajdinovic (@aajdinov), Ethan Devenport (@edevenport)

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, remove, update load balancers. This module has a dependency on 1and1 >= 1.0.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    name: ansible load balancer
    description: Testing creation of load balancer with ansible
    health_check_test: TCP
    health_check_interval: 40
    persistence: true
    persistence_time: 1200
    method: ROUND_ROBIN
    datacenter: US
    rules:
     -
       protocol: TCP
       port_balancer: 80
       port_server: 80
       source: 0.0.0.0
    wait: true
    wait_timeout: 500
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Destroy a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    name: ansible load balancer
    wait: true
    wait_timeout: 500
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    load_balancer: ansible load balancer
    name: ansible load balancer updated
    description: Testing the update of a load balancer with ansible
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add server to a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    load_balancer: ansible load balancer updated
    description: Adding server to a load balancer with ansible
    add_server_ips:
     - server identifier (id or name)
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove server from a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    load_balancer: ansible load balancer updated
    description: Removing server from a load balancer with ansible
    remove_server_ips:
     - B2504878540DBC5F7634EB00A07C1EBD (server's ip id)
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add rules to a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    load_balancer: ansible load balancer updated
    description: Adding rules to a load balancer with ansible
    add_rules:
     -
       protocol: TCP
       port_balancer: 70
       port_server: 70
       source: 0.0.0.0
     -
       protocol: TCP
       port_balancer: 60
       port_server: 60
       source: 0.0.0.0
    wait: true
    wait_timeout: 500
    state: update
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove rules from a load balancer
  community.general.oneandone_load_balancer:
    auth_token: oneandone_private_api_key
    load_balancer: ansible load balancer updated
    description: Adding rules to a load balancer with ansible
    remove_rules:
     - rule_id #1
     - rule_id #2
     - ...
    wait: true
    wait_timeout: 500
    state: update

Inputs

    
name:
    description:
    - Load balancer name used with present state. Used as identifier (id or name) when
      used with absent state. maxLength=128
    type: str

wait:
    default: true
    description:
    - wait for the instance to be in state 'running' before returning
    required: false
    type: bool

rules:
    default: []
    description:
    - A list of rule objects that will be set for the load balancer. Each rule must contain
      protocol, port_balancer, and port_server parameters, in addition to source parameter,
      which is optional.
    elements: dict
    type: list

state:
    choices:
    - present
    - absent
    - update
    default: present
    description:
    - Define a load balancer state to create, remove, or update.
    required: false
    type: str

method:
    choices:
    - ROUND_ROBIN
    - LEAST_CONNECTIONS
    description:
    - Balancing procedure.
    type: str

api_url:
    description:
    - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
    required: false
    type: str

add_rules:
    default: []
    description:
    - A list of rules that will be added to an existing load balancer. It is syntax is
      the same as the one used for rules parameter. Used in combination with update state.
    elements: dict
    required: false
    type: list

auth_token:
    description:
    - Authenticating API token provided by 1&1.
    type: str

datacenter:
    choices:
    - US
    - ES
    - DE
    - GB
    description:
    - ID or country code of the datacenter where the load balancer will be created.
    - If not specified, it defaults to V(US).
    required: false
    type: str

description:
    description:
    - Description of the load balancer. maxLength=256
    required: false
    type: str

persistence:
    description:
    - Persistence.
    type: bool

remove_rules:
    default: []
    description:
    - A list of rule ids that will be removed from an existing load balancer. Used in
      combination with update state.
    elements: str
    required: false
    type: list

wait_timeout:
    default: 600
    description:
    - how long before wait gives up, in seconds
    type: int

load_balancer:
    description:
    - The identifier (id or name) of the load balancer used with update state.
    type: str

wait_interval:
    default: 5
    description:
    - Defines the number of seconds to wait when using the _wait_for methods
    type: int

add_server_ips:
    default: []
    description:
    - A list of server identifiers (id or name) to be assigned to a load balancer. Used
      in combination with update state.
    elements: str
    required: false
    type: list

persistence_time:
    description:
    - Persistence time in seconds. Required if persistence is enabled. minimum=30, maximum=1200,
      multipleOf=1
    type: str

health_check_path:
    description:
    - Url to call for checking. Required for HTTP health check. maxLength=1000
    required: false
    type: str

health_check_test:
    choices:
    - NONE
    - TCP
    - HTTP
    - ICMP
    description:
    - Type of the health check. At the moment, HTTP is not allowed.
    type: str

remove_server_ips:
    default: []
    description:
    - A list of server IP ids to be unassigned from a load balancer. Used in combination
      with update state.
    elements: str
    required: false
    type: list

health_check_parse:
    description:
    - Regular expression to check. Required for HTTP health check. maxLength=64
    required: false
    type: str

health_check_interval:
    description:
    - Health check period in seconds. minimum=5, maximum=300, multipleOf=1
    type: str

Outputs

load_balancer:
  description: Information about the load balancer that was processed
  returned: always
  sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Balancer"}'
  type: dict