community.general.oneandone_load_balancer module – Configure 1&1 load balancer
Note
This module is part of the community.general collection (version 6.6.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.oneandone_load_balancer
.
Synopsis
Create, remove, update load balancers. This module has a dependency on 1and1 >= 1.0.
Requirements
The below requirements are needed on the host that executes this module.
1and1
python >= 2.6
Parameters
Parameter |
Comments |
---|---|
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. Default: |
|
A list of server identifiers (id or name) to be assigned to a load balancer. Used in combination with update state. Default: |
|
Custom API URL. Overrides the ONEANDONE_API_URL environment variable. |
|
Authenticating API token provided by 1&1. |
|
ID or country code of the datacenter where the load balancer will be created. If not specified, it defaults to US. Choices:
|
|
Description of the load balancer. maxLength=256 |
|
Health check period in seconds. minimum=5, maximum=300, multipleOf=1 |
|
Regular expression to check. Required for HTTP health check. maxLength=64 |
|
Url to call for checking. Required for HTTP health check. maxLength=1000 |
|
Type of the health check. At the moment, HTTP is not allowed. Choices:
|
|
The identifier (id or name) of the load balancer used with update state. |
|
Balancing procedure. Choices:
|
|
Load balancer name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128 |
|
Persistence. Choices:
|
|
Persistence time in seconds. Required if persistence is enabled. minimum=30, maximum=1200, multipleOf=1 |
|
A list of rule ids that will be removed from an existing load balancer. Used in combination with update state. Default: |
|
A list of server IP ids to be unassigned from a load balancer. Used in combination with update state. Default: |
|
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. Default: |
|
Define a load balancer state to create, remove, or update. Choices:
|
|
wait for the instance to be in state ‘running’ before returning Choices:
|
|
Defines the number of seconds to wait when using the _wait_for methods Default: |
|
how long before wait gives up, in seconds Default: |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- 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
- 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
- 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
- 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
- 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
- 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
- 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Information about the load balancer that was processed Returned: always Sample: |
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication