oracle / oracle.oci / 3.5.0 / module / oci_network_load_balancer Manage a NetworkLoadBalancer resource in Oracle Cloud Infrastructure | "added in version" 2.9.0 of oracle.oci" Authors: Oracle (@oracle) preview | supported by communityoracle.oci.oci_network_load_balancer (3.5.0) — module
Install with ansible-galaxy collection install oracle.oci:==3.5.0
collections: - name: oracle.oci version: 3.5.0
This module allows the user to create, update and delete a NetworkLoadBalancer resource in Oracle Cloud Infrastructure
For I(state=present), creates a network load balancer.
This resource has the following action operations in the M(oracle.oci.oci_network_load_balancer_actions) module: change_compartment.
- name: Create network_load_balancer oci_network_load_balancer: # required compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx" subnet_id: "ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx" display_name: display_name_example # optional reserved_ips: - # optional id: "ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx" is_private: true is_preserve_source_destination: true nlb_ip_version: IPV4 freeform_tags: {'Department': 'Finance'} defined_tags: {'Operations': {'CostCenter': 'US'}}
- name: Update network_load_balancer oci_network_load_balancer: # required network_load_balancer_id: "ocid1.networkloadbalancer.oc1..xxxxxxEXAMPLExxxxxx" # optional display_name: display_name_example is_preserve_source_destination: true nlb_ip_version: IPV4 freeform_tags: {'Department': 'Finance'} defined_tags: {'Operations': {'CostCenter': 'US'}}
- name: Update network_load_balancer using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set) oci_network_load_balancer: # required compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx" display_name: display_name_example # optional is_preserve_source_destination: true nlb_ip_version: IPV4 freeform_tags: {'Department': 'Finance'} defined_tags: {'Operations': {'CostCenter': 'US'}}
- name: Delete network_load_balancer oci_network_load_balancer: # required network_load_balancer_id: "ocid1.networkloadbalancer.oc1..xxxxxxEXAMPLExxxxxx" state: absent
- name: Delete network_load_balancer using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set) oci_network_load_balancer: # required compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx" display_name: display_name_example state: absent
wait: default: true description: Whether to wait for create or delete operation to complete. type: bool state: choices: - present - absent default: present description: - The state of the NetworkLoadBalancer. - Use I(state=present) to create or update a NetworkLoadBalancer. - Use I(state=absent) to delete a NetworkLoadBalancer. required: false type: str key_by: description: The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource. elements: str type: list region: description: - 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 C(config_file_location)). Please refer to U(https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm) for more information on OCI regions. type: str tenancy: description: - 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 C(config_file_location)). To get the tenancy OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm) type: str api_user: description: - The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See C(config_file_location)). To get the user's OCID, please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm). type: str auth_type: choices: - api_key - instance_principal - instance_obo_user - resource_principal default: api_key description: - The type of authentication to use for making API requests. By default C(auth_type="api_key") based authentication is performed and the API key (see I(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 C(auth_type="instance_principal") to use instance principal based authentication when running ansible playbooks within an OCI compute instance. type: str subnet_id: description: - The subnet in which the network load balancer is spawned L(OCIDs,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm). - Required for create using I(state=present). type: str is_private: description: - Whether the network load balancer has a virtual cloud network-local (private) IP address. - If "true", then the service assigns a private IP address to the network load balancer. - If "false", then the service assigns a public IP address to the network load balancer. - A public network load balancer is accessible from the internet, depending on the L(security list rules,https://docs.cloud.oracle.com/Content/network/Concepts/securitylists.htm) for your virtual cloud network. For more information about public and private network load balancers, see L(How Network Load Balancing Works,https://docs.cloud.oracle.com/Content/Balance/Concepts/balanceoverview.htm#how-network-load-balancing- works). This value is true by default. - 'Example: `true`' type: bool cert_bundle: description: - The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used. type: str auth_purpose: choices: - service_principal description: - The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None. type: str defined_tags: description: - 'Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`' - This parameter is updatable. type: dict display_name: aliases: - name description: - Network load balancer identifier, which can be renamed. - Required for create using I(state=present). - Required for update, delete when environment variable C(OCI_USE_NAME_AS_IDENTIFIER) is set. - This parameter is updatable when C(OCI_USE_NAME_AS_IDENTIFIER) is not set. type: str force_create: default: false description: Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with I(key_by). type: bool reserved_ips: description: - An array of reserved Ips. elements: dict suboptions: id: description: - OCID of the reserved public IP address created with the virtual cloud network. - Reserved public IP addresses are IP addresses that are registered using the virtual cloud network API. - Create a reserved public IP address. When you create the network load balancer, enter the OCID of the reserved public IP address in the reservedIp field to attach the IP address to the network load balancer. This task configures the network load balancer to listen to traffic on this IP address. - Reserved public IP addresses are not deleted when the network load balancer is deleted. The IP addresses become unattached from the network load balancer. - 'Example: "ocid1.publicip.oc1.phx.unique_ID"' type: str type: list wait_timeout: description: Time, in seconds, to wait when I(wait=yes). Defaults to 1200 for most of the services but some services might have a longer wait timeout. type: int freeform_tags: description: - 'Simple key-value pair that is applied without any predefined name, type, or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`' - This parameter is updatable. type: dict compartment_id: description: - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment containing the network load balancer. - Required for create using I(state=present). - Required for update when environment variable C(OCI_USE_NAME_AS_IDENTIFIER) is set. - Required for delete when environment variable C(OCI_USE_NAME_AS_IDENTIFIER) is set. type: str nlb_ip_version: choices: - IPV4 - IPV4_AND_IPV6 description: - IP version associated with the NLB. - This parameter is updatable. type: str api_user_key_file: description: - 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 C(config_file_location)). If the key is encrypted with a pass-phrase, the C(api_user_key_pass_phrase) option must also be provided. type: str config_profile_name: description: - The profile to load from the config file referenced by C(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 C(config_file_location). type: str api_user_fingerprint: description: - 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 C(config_file_location)). To get the key pair's fingerprint value please refer U(https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm). type: str config_file_location: description: - 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. type: str api_user_key_pass_phrase: description: - Passphrase used by the key referenced in C(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 C(config_file_location)). type: str network_load_balancer_id: aliases: - id description: - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the network load balancer to update. - Required for update using I(state=present) when environment variable C(OCI_USE_NAME_AS_IDENTIFIER) is not set. - Required for delete using I(state=absent) when environment variable C(OCI_USE_NAME_AS_IDENTIFIER) is not set. type: str is_preserve_source_destination: description: - This parameter can be enabled only if backends are compute OCIDs. When enabled, the skipSourceDestinationCheck parameter is automatically enabled on the load balancer VNIC, and packets are sent to the backend with the entire IP header intact. - This parameter is updatable. type: bool
network_load_balancer: contains: backend_sets: contains: backends: contains: ip_address: description: - 'The IP address of the backend server. Example: `10.0.0.3`' returned: on success sample: ip_address_example type: str is_backup: description: - Whether the network load balancer should treat this server as a backup unit. If `true`, then the network load balancer forwards no ingress traffic to this backend server unless all other backend servers not marked as "isBackup" fail the health check policy. - 'Example: `false`' returned: on success sample: true type: bool is_drain: description: - Whether the network load balancer should drain this server. Servers marked "isDrain" receive no incoming traffic. - 'Example: `false`' returned: on success sample: true type: bool is_offline: description: - Whether the network load balancer should treat this server as offline. Offline servers receive no incoming traffic. - 'Example: `false`' returned: on success sample: true type: bool name: description: - A read-only field showing the IP address/IP OCID and port that uniquely identify this backend server in the backend set. - 'Example: `10.0.0.3:8080`, or `ocid1.privateip..oc1.<var>&lt;unique_ID&gt;</var>:443` or `10.0.0.3:0`' returned: on success sample: name_example type: str port: description: - The communication port for the backend server. - 'Example: `8080`' returned: on success sample: 56 type: int target_id: description: - 'The IP OCID/Instance OCID associated with the backend server. Example: `ocid1.privateip..oc1.<var>&lt;unique_ID&gt;</var>`' returned: on success sample: ocid1.target.oc1..xxxxxxEXAMPLExxxxxx type: str weight: description: - The network 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 three times the number of new connections as a server weighted '1'. For more information about load balancing policies, see L(How Network Load Balancing Policies Work,https://docs.cloud.oracle.com/Content/Balance/Reference/lbpolicies.htm). - 'Example: `3`' returned: on success sample: 56 type: int description: - Array of backends. returned: on success type: complex health_checker: contains: interval_in_millis: description: - The interval between health checks, in milliseconds. The default value is 10000 (10 seconds). - 'Example: `10000`' returned: on success sample: 56 type: int port: description: - The backend server port against which to run the health check. If the port is not specified, then the network load balancer uses the port information from the `Backend` object. The port must be specified if the backend port is 0. - 'Example: `8080`' returned: on success sample: 56 type: int protocol: description: - The protocol the health check must use; either HTTP or HTTPS, or UDP or TCP. - 'Example: `HTTP`' returned: on success sample: HTTP type: str request_data: description: - Base64 encoded pattern to be sent as UDP or TCP health check probe. returned: on success sample: 'null' type: str response_body_regex: description: - A regular expression for parsing the response body from the backend server. - 'Example: `^((?!false).|\s)*$`' returned: on success sample: response_body_regex_example type: str response_data: description: - Base64 encoded pattern to be validated as UDP or TCP health check probe response. returned: on success sample: 'null' type: str retries: description: - The number of retries to attempt before a backend server is considered "unhealthy". This number also applies when recovering a server to the "healthy" state. The default value is 3. - 'Example: `3`' returned: on success sample: 56 type: int return_code: description: - The status code a healthy backend server should return. If you configure the health check policy to use the HTTP protocol, then you can use common HTTP status codes such as "200". - 'Example: `200`' returned: on success sample: 56 type: int timeout_in_millis: description: - 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. The default value is 3000 (3 seconds). - 'Example: `3000`' returned: on success sample: 56 type: int url_path: description: - The path against which to run the health check. - 'Example: `/healthcheck`' returned: on success sample: url_path_example type: str description: - '' returned: on success type: complex ip_version: description: - IP version associated with the backend set. returned: on success sample: IPV4 type: str is_preserve_source: description: - If this parameter is enabled, then the network load balancer preserves the source IP of the packet when it is forwarded to backends. Backends see the original source IP. If the isPreserveSourceDestination parameter is enabled for the network load balancer resource, then this parameter cannot be disabled. The value is true by default. returned: on success sample: true type: bool name: description: - A user-friendly name for the backend set that must be unique and cannot be changed. - Valid backend set names include only alphanumeric characters, dashes, and underscores. Backend set names cannot contain spaces. Avoid entering confidential information. - 'Example: `example_backend_set`' returned: on success sample: name_example type: str policy: description: - The network load balancer policy for the backend set. - 'Example: `FIVE_TUPLE`' returned: on success sample: TWO_TUPLE type: str description: - Backend sets associated with the network load balancer. returned: on success type: complex compartment_id: description: - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment containing the network load balancer. returned: on success sample: ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx type: str defined_tags: description: - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see L(Resource Tags,https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm). - 'Example: `{"Operations": {"CostCenter": "42"}}`' returned: on success sample: Operations: CostCenter: US type: dict display_name: description: - A user-friendly name, which does not have to be unique, and can be changed. - 'Example: `example_load_balancer`' returned: on success sample: display_name_example type: str freeform_tags: description: - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see L(Resource Tags,https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm). - 'Example: `{"Department": "Finance"}`' returned: on success sample: Department: Finance type: dict id: description: - The L(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the network load balancer. returned: on success sample: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx type: str ip_addresses: contains: ip_address: description: - An IP address. - 'Example: `192.168.0.3`' returned: on success sample: ip_address_example type: str ip_version: description: - IP version associated with this IP address. returned: on success sample: IPV4 type: str is_public: description: - Whether the IP address is public or private. - If "true", then the IP address is public and accessible from the internet. - If "false", then the IP address is private and accessible only from within the associated virtual cloud network. returned: on success sample: true type: bool reserved_ip: contains: id: description: - OCID of the reserved public IP address created with the virtual cloud network. - Reserved public IP addresses are IP addresses that are registered using the virtual cloud network API. - Create a reserved public IP address. When you create the network load balancer, enter the OCID of the reserved public IP address in the reservedIp field to attach the IP address to the network load balancer. This task configures the network load balancer to listen to traffic on this IP address. - Reserved public IP addresses are not deleted when the network load balancer is deleted. The IP addresses become unattached from the network load balancer. - 'Example: "ocid1.publicip.oc1.phx.unique_ID"' returned: on success sample: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx type: str description: - '' returned: on success type: complex description: - An array of IP addresses. returned: on success type: complex is_preserve_source_destination: description: - When enabled, the skipSourceDestinationCheck parameter is automatically enabled on the load balancer VNIC. Packets are sent to the backend set without any changes to the source and destination IP. returned: on success sample: true type: bool is_private: description: - Whether the network load balancer has a virtual cloud network-local (private) IP address. - If "true", then the service assigns a private IP address to the network load balancer. - If "false", then the service assigns a public IP address to the network load balancer. - A public network load balancer is accessible from the internet, depending the L(security list rules,https://docs.cloud.oracle.com/Content/network/Concepts/securitylists.htm) for your virtual cloudn network. For more information about public and private network load balancers, see L(How Network Load Balancing Works,https://docs.cloud.oracle.com/Content/Balance/Concepts/balanceoverview.htm#how-network-load-balancing- works). This value is true by default. - 'Example: `true`' returned: on success sample: true type: bool lifecycle_details: description: - A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state. returned: on success sample: lifecycle_details_example type: str lifecycle_state: description: - The current state of the network load balancer. returned: on success sample: CREATING type: str listeners: contains: default_backend_set_name: description: - The name of the associated backend set. - 'Example: `example_backend_set`' returned: on success sample: default_backend_set_name_example type: str ip_version: description: - IP version associated with the listener. returned: on success sample: IPV4 type: str name: description: - A friendly name for the listener. It must be unique and it cannot be changed. - 'Example: `example_listener`' returned: on success sample: name_example type: str port: description: - The communication port for the listener. - 'Example: `80`' returned: on success sample: 56 type: int protocol: description: - The protocol on which the listener accepts connection requests. For public network load balancers, ANY protocol refers to TCP/UDP. For private network load balancers, ANY protocol refers to TCP/UDP/ICMP (note that ICMP requires isPreserveSourceDestination to be set to true). To get a list of valid protocols, use the L(ListNetworkLoadBalancersProtocols,https://docs.cloud.oracle.com/en- us/iaas/api/#/en/NetworkLoadBalancer/20200501/networkLoadBalancerProtocol/ListNetworkLoadBalancersProtocols) operation. - 'Example: `TCP`' returned: on success sample: ANY type: str description: - Listeners associated with the network load balancer. returned: on success type: complex network_security_group_ids: description: - An array of network security groups L(OCIDs,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) associated with the network load balancer. - During the creation of the network load balancer, the service adds the new load balancer to the specified network security groups. - 'The benefits of associating the network load balancer with network security groups include:' - '* Network security groups define network security rules to govern ingress and egress traffic for the network load balancer.' - '* The network security rules of other resources can reference the network security groups associated with the network load balancer to ensure access.' - 'Example: ["ocid1.nsg.oc1.phx.unique_ID"]' returned: on success sample: [] type: list nlb_ip_version: description: - IP version associated with the NLB. returned: on success sample: IPV4 type: str subnet_id: description: - The subnet in which the network load balancer is spawned L(OCIDs,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)." returned: on success sample: ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx type: str system_tags: description: - 'Key-value pair representing system tags'' keys and values scoped to a namespace. Example: `{"bar-key": "value"}`' returned: on success sample: {} type: dict time_created: description: - The date and time the network load balancer was created, in the format defined by RFC3339. - 'Example: `2020-05-01T21:10:29.600Z`' returned: on success sample: '2013-10-20T19:20:30+01:00' type: str time_updated: description: - The time the network load balancer was updated. An RFC3339 formatted date-time string. - 'Example: `2020-05-01T22:10:29.600Z`' returned: on success sample: '2013-10-20T19:20:30+01:00' type: str description: - Details of the NetworkLoadBalancer resource acted upon by the current operation returned: on success sample: backend_sets: backends: - ip_address: ip_address_example is_backup: true is_drain: true is_offline: true name: name_example port: 56 target_id: ocid1.target.oc1..xxxxxxEXAMPLExxxxxx weight: 56 health_checker: interval_in_millis: 56 port: 56 protocol: HTTP request_data: null response_body_regex: response_body_regex_example response_data: null retries: 56 return_code: 56 timeout_in_millis: 56 url_path: url_path_example ip_version: IPV4 is_preserve_source: true name: name_example policy: TWO_TUPLE compartment_id: ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx defined_tags: Operations: CostCenter: US display_name: display_name_example freeform_tags: Department: Finance id: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx ip_addresses: - ip_address: ip_address_example ip_version: IPV4 is_public: true reserved_ip: id: ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx is_preserve_source_destination: true is_private: true lifecycle_details: lifecycle_details_example lifecycle_state: CREATING listeners: default_backend_set_name: default_backend_set_name_example ip_version: IPV4 name: name_example port: 56 protocol: ANY network_security_group_ids: [] nlb_ip_version: IPV4 subnet_id: ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx system_tags: {} time_created: '2013-10-20T19:20:30+01:00' time_updated: '2013-10-20T19:20:30+01:00' type: complex