oci_load_balancer_backend_set - Create, update and delete a backend set of a load balancer.

New in version 2.5.

Synopsis

  • Create an OCI Load Balancer Backend Set
  • Update OCI Load Balancers Backend Set, if present.
  • Delete OCI Load Balancers Backend Set, if present.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_OCID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_type
    Choices:
  • api_key ←
  • instance_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
backends
A list of configurations related to Backends that are part of a backend set.
drain Default:
no
Specifies whether the load balancer should drain this server. Servers marked "drain" receive no new incoming traffic.
weight Default:
1
Describes the load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections as a server weighted '1'.
backup Default:
no
Specifies whether the load balancer should treat this server as a backup unit. If true, the load balancer forwards no ingress traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy.
offline Default:
no
Ensures whether the load balancer should treat this server as offline. Offline servers receive no incoming traffic.
ip_address
required
IP address of the backend server.
port
required
The communication port for the backend server
config_file_location
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
delete_backends
bool
    Choices:
  • no ←
  • yes
Delete any backends in the Backend Set named name that is specified in backends. If delete_backends=yes, backends provided by backends would be deleted from existing backends, if they are part of existing backends. If they are not part of existing backends, they will be ignored. delete_backends and purge_backends are mutually exclusive.
health_checker
Describes the health check policy for a backend set.
retries Default:
3
Describes the number of retries to attempt before a backend server is considered unhealthy.
protocol
required
    Choices:
  • HTTP
  • TCP
Describes the protocol the health check must use, either HTTP or TCP.
response_body_regex Default:
.*
Describes a regular expression for parsing the response body from the backend server.
return_code Default:
200
Describes the status code a healthy backend server should return.
timeout_in_millis Default:
3000
Describes the maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply returns within this timeout period.
interval_in_millis Default:
10000
Describes the interval between health checks, in milliseconds.
url_path
required
Describes the path against which to run the health check.
port Default:
0
Describes the backend server port against which to run the health check. If the port is not specified, the load balancer uses the port information from the backends.
load_balancer_id
required
Identifier of the Load Balancer. Mandatory for create,delete and update.

aliases: id
name
Name of the Load Balancer Backend Set. A user friendly name. Does not have to be unique, and could be changed. Mandatory for create and update.
policy
The load balancer policy for the backend set. oci_load_balancer_policy_facts could be used to fetch policy types suupported by OCI Load Balancer Service.
purge_backends
bool
    Choices:
  • no
  • yes ←
Purge any backends in the Backend Set named name that is not specified in backends. If purge_backends=no, provided backends would be appended to existing backends. purge_backends and delete_backends are mutually exclusive.
region
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
session_persistence_configuration
The configuration details for implementing session persistence. Session persistence enables the Load Balancing Service to direct any number of requests that originate from a single logical client to a single backend web server.
cookie_name
required
Describes the name of the cookie used to detect a session initiated by the backend server. Use '*' to specify that any cookie set by the backend causes the session to persist.
disable_fallback Default:
no
DescribesWhether the load balancer is prevented from directing traffic from a persistent session client to a different backend server if the original server is unavailable.
ssl_configuration
The load balancer's SSL handling configuration details.
certificate_name
required
Describes a friendly name for the certificate bundle. It must be unique and it cannot be changed. Valid certificate bundle names include only alphanumeric characters, dashes, and underscores.Certificate bundle names cannot contain spaces.
verify_depth
Describes the maximum depth for peer certificate chain verification.
verify_peer_certificate
Describeswhether the load balancer listener should verify peer certificates.
state
    Choices:
  • present ←
  • absent
Create,update or delete Load Balancer Backend Set. For state=present, if it does not exists, it gets created. If exists, it gets updated.
tenancy
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
wait
bool
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout Default:
1200
Time, in seconds, to wait when wait=yes.
wait_until
The lifecycle state to wait for the resource to transition into when wait=yes. By default, when wait=yes, we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/ RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/ TERMINATED lifecycle state during delete operation.

Examples

# Note: These examples do not set authentication details.
# Create Create a backend set named "ansible_backend_set" in a load balancer
- name: Create Load Balancer Backend Set
  oci_load_balancer_backend_set:
    name: "ansible_backend_set"
    load_balancer_id: "ocid1.loadbalancer.oc1.iad.xxxxxEXAMPLExxxxx"
    backends:
          - ip_address: "10.159.34.21"
            port: 8080
    health_checker:
          interval_in_millis: 30000
          port: 8080
          protocol: "HTTP"
          response_body_regex: "^(500|40[1348])$"
          retries: 3
          timeout_in_millis: 6000
          return_code: 200
          url_path: "/healthcheck"
    policy: "LEAST_CONNECTIONS"
    session_persistence_configuration:
      cookie_name: "ansible_backend_set_cookie"
      disable_fallback: True
    ssl_configuration:
      certificate_name: "certs1"
      verify_depth: 3
      verify_peer_certificate: True
    state: 'present'

# Update Load Balancer Backend Set
- name: Update Load Balancer Backend Set
  oci_load_balancer_backend_set:
    load_balancer_id: "ocid1.loadbalancer.oc1.iad.xxxxxEXAMPLExxxxx"
    name: "ansible_backend_set"
    backends:
          - ip_address: "10.159.34.25"
            port: 8282
    purge_backends: 'no'
    state: 'present'

# Update Load Balancer Backend Set by deleting backends
- name: Update Load Balancer Backend Set by deleting backends
  oci_load_balancer_backend_set:
    load_balancer_id: "ocid1.loadbalancer.oc1.iad.xxxxxEXAMPLExxxxx"
    name: "ansible_backend_set"
    backends:
          - ip_address: "10.159.34.25"
            port: 8282
    delete_backends: 'yes'
    state: 'present'

# Deleted Load Balancer Backend Set
- name: Update Load Balancer Backend Set
  oci_load_balancer_backend_set:
    load_balancer_id: "ocid1.loadbalancer.oc1.iad.xxxxxEXAMPLExxxxx"
    name: "ansible_backend_set"
    state: 'absent'

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
backend_set
complex
success
Attributes of the created/updated Load Balancer Backend Set. For delete, deleted Load Balancer Backend Set description will be returned.

Sample:
{'ssl_configuration': {'certificate_name': 'certs1', 'verify_depth': 1, 'verify_peer_certificate': True}, 'backends': [{'drain': False, 'name': '10.159.34.21:8080', 'weight': 1, 'ip_address': '10.159.34.21', 'offline': False, 'backup': False, 'port': 8080}, {'drain': False, 'name': '10.159.34.21:8282', 'weight': 1, 'ip_address': '10.159.34.21', 'offline': False, 'backup': False, 'port': 8282}], 'health_checker': {'retries': 3, 'protocol': 'HTTP', 'response_body_regex': '^(500|40[1348])$', 'return_code': 500, 'timeout_in_millis': 6000, 'interval_in_millis': 30000, 'url_path': '/healthcheck', 'port': 8080}, 'name': 'backend_set_1', 'policy': 'IP_HASH', 'session_persistence_configuration': {'cookie_name': 'first_backend_set_cookie_updated', 'disable_fallback': True}}
  ssl_configuration
dict
always
The load balancer's SSL handling configuration details.

Sample:
{'certificate_name': 'certs1', 'verify_depth': 1, 'verify_peer_certificate': True}
  backends
list
always
A list of configurations related to Backends that are part of the backend set

Sample:
[{'drain': False, 'name': '10.159.34.21:8080', 'weight': 1, 'ip_address': '10.159.34.21', 'offline': False, 'backup': False, 'port': 8080}, {'drain': False, 'name': '10.159.34.21:8282', 'weight': 1, 'ip_address': '10.159.34.21', 'offline': False, 'backup': False, 'port': 8282}]
  health_checker
dict
always
Health check policy for a backend set.

Sample:
{'retries': 3, 'protocol': 'HTTP', 'response_body_regex': '^(500|40[1348])$', 'return_code': 200, 'timeout_in_millis': 6000, 'interval_in_millis': 30000, 'url_path': '/healthcheck', 'port': 8080}
  name
string
always
Name assigned to the Load Balancer Backend Set during creation

Sample:
ansible_backend_set
  policy
string
always
The load balancer policy for the backend set.

Sample:
LEAST_CONNECTIONS
  session_persistence_configuration
dict
always
The configuration details for implementing session persistence

Sample:
{'cookie_name': 'first_backend_set_cookie', 'disable_fallback': True}


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Debayan Gupta(@debayan_gupta)

Hint

If you notice any issues in this documentation you can edit this document to improve it.