# avi_pool – Module for setup of Pool Avi RESTful Object

- Synopsis
- Requirements
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- This module is used to configure Pool object
- more examples at https://github.com/avinetworks/devops

## Requirements

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

- avisdk

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
a_pool - |  | Name of container cloud application that constitutes a pool in a a-b pool configuration, if different from vs app. Field deprecated in 18.1.2.
ab_pool - |  | A/b pool configuration. Field deprecated in 18.1.2.
ab_priority - |  | Priority of this pool in a a-b pool pair. Internally used. Field deprecated in 18.1.2.
analytics_policy - added in 2.9 |  | Determines analytics settings for the pool. Field introduced in 18.1.5, 18.2.1.
analytics_profile_ref - added in 2.9 |  | Specifies settings related to analytics. It is a reference to an object of type analyticsprofile. Field introduced in 18.1.4,18.2.1.
api_context dictionary added in 2.5 |  | Avi API context that includes current session ID and CSRF Token. This allows user to perform single login and re-use the session.
api_version string | Default: "16.4.4" | Avi API version of to use for Avi API and objects.
apic_epg_name - |  | Synchronize cisco apic epg members with pool servers.
application_persistence_profile_ref - |  | Persistence will ensure the same user sticks to the same server for a desired duration of time. It is a reference to an object of type applicationpersistenceprofile.
autoscale_launch_config_ref - |  | If configured then avi will trigger orchestration of pool server creation and deletion. It is only supported for container clouds like mesos, openshift, kubernetes, docker, etc. It is a reference to an object of type autoscalelaunchconfig.
autoscale_networks - |  | Network ids for the launch configuration.
autoscale_policy_ref - |  | Reference to server autoscale policy. It is a reference to an object of type serverautoscalepolicy.

avi_api_patch_op
-
added in 2.5

Choices:
- add
- replace
- delete

Patch operation to use when using avi_api_update_method as patch.

avi_api_update_method
-
added in 2.5

Choices:
- put ←
- patch

Default method for object update is HTTP PUT.
Setting to patch will override that behavior to use HTTP PATCH.

avi_credentials dictionary added in 2.5 |  | Avi Credentials dictionary which can be used in lieu of enumerating Avi Controller login details.
| api_version - | Default: "16.4.4" | Avi controller version
| controller - |  | Avi controller IP or SQDN
| csrftoken - |  | Avi controller API csrftoken to reuse existing session with session id
| password - |  | Avi controller password
| port - |  | Avi controller port
| session_id - |  | Avi controller API session id to reuse existing session with csrftoken
| tenant - | Default: "admin" | Avi controller tenant
| tenant_uuid - |  | Avi controller tenant UUID
| timeout - | Default: 300 | Avi controller request timeout
| token - |  | Avi controller API token
| username - |  | Avi controller username

avi_disable_session_cache_as_fact
boolean
added in 2.6

Choices:
- no
- yes

It disables avi session information to be cached as a fact.

capacity_estimation
boolean

Choices:
- no
- yes

Inline estimation of capacity of servers.
Default value when not specified in API or module is interpreted by Avi Controller as False.

capacity_estimation_ttfb_thresh - |  | The maximum time-to-first-byte of a server. Allowed values are 1-5000. Special values are 0 - 'automatic'. Default value when not specified in API or module is interpreted by Avi Controller as 0.
cloud_config_cksum - |  | Checksum of cloud configuration for pool. Internally set by cloud connector.
cloud_ref - |  | It is a reference to an object of type cloud.
conn_pool_properties - added in 2.9 |  | Connection pool properties. Field introduced in 18.2.1.
connection_ramp_duration - |  | Duration for which new connections will be gradually ramped up to a server recently brought online. Useful for lb algorithms that are least connection based. Allowed values are 1-300. Special values are 0 - 'immediate'. Default value when not specified in API or module is interpreted by Avi Controller as 10.
controller string | Default: "" | IP address or hostname of the controller. The default value is the environment variable `AVI_CONTROLLER`.
created_by - |  | Creator name.
default_server_port - |  | Traffic sent to servers will use this destination server port unless overridden by the server's specific port attribute. The ssl checkbox enables avi to server encryption. Allowed values are 1-65535. Default value when not specified in API or module is interpreted by Avi Controller as 80.

delete_server_on_dns_refresh
boolean
added in 2.9

Choices:
- no
- yes

Indicates whether existing ips are disabled(false) or deleted(true) on dns hostname refreshdetail -- on a dns refresh, some ips set on pool may
no longer be returned by the resolver.
These ips are deleted from the pool when this knob is set to true.
They are disabled, if the knob is set to false.
Field introduced in 18.2.3.
Default value when not specified in API or module is interpreted by Avi Controller as True.

description - |  | A description of the pool.
domain_name - |  | Comma separated list of domain names which will be used to verify the common names or subject alternative names presented by server certificates. It is performed only when common name check host_check_enabled is enabled.

east_west
boolean

Choices:
- no
- yes

Inherited config from virtualservice.

enabled
boolean

Choices:
- no
- yes

Enable or disable the pool.
Disabling will terminate all open connections and pause health monitors.
Default value when not specified in API or module is interpreted by Avi Controller as True.

external_autoscale_groups - |  | Names of external auto-scale groups for pool servers. Currently available only for aws and azure. Field introduced in 17.1.2.
fail_action - |  | Enable an action - close connection, http redirect or local http response - when a pool failure happens. By default, a connection will be closed, in case the pool experiences a failure.
fewest_tasks_feedback_delay - |  | Periodicity of feedback for fewest tasks server selection algorithm. Allowed values are 1-300. Default value when not specified in API or module is interpreted by Avi Controller as 10.
graceful_disable_timeout - |  | Used to gracefully disable a server. Virtual service waits for the specified time before terminating the existing connections to the servers that are disabled. Allowed values are 1-7200. Special values are 0 - 'immediate', -1 - 'infinite'. Default value when not specified in API or module is interpreted by Avi Controller as 1.

gslb_sp_enabled
boolean
added in 2.5

Choices:
- no
- yes

Indicates if the pool is a site-persistence pool.
Field introduced in 17.2.1.

health_monitor_refs
-

Verify server health by applying one or more health monitors.
Active monitors generate synthetic traffic from each service engine and mark a server up or down based on the response.
The passive monitor listens only to client to server communication.
It raises or lowers the ratio of traffic destined to a server based on successful responses.
It is a reference to an object of type healthmonitor.

host_check_enabled
boolean

Choices:
- no
- yes

Enable common name check for server certificate.
If enabled and no explicit domain name is specified, avi will use the incoming host header to do the match.
Default value when not specified in API or module is interpreted by Avi Controller as False.

inline_health_monitor
boolean

Choices:
- no
- yes

The passive monitor will monitor client to server connections and requests and adjust traffic load to servers based on successful responses.
This may alter the expected behavior of the lb method, such as round robin.
Default value when not specified in API or module is interpreted by Avi Controller as True.

ipaddrgroup_ref - |  | Use list of servers from ip address group. It is a reference to an object of type ipaddrgroup.

lb_algorithm
-

The load balancing algorithm will pick a server within the pool's list of available servers.
Enum options - LB_ALGORITHM_LEAST_CONNECTIONS, LB_ALGORITHM_ROUND_ROBIN, LB_ALGORITHM_FASTEST_RESPONSE, LB_ALGORITHM_CONSISTENT_HASH,
LB_ALGORITHM_LEAST_LOAD, LB_ALGORITHM_FEWEST_SERVERS, LB_ALGORITHM_RANDOM, LB_ALGORITHM_FEWEST_TASKS, LB_ALGORITHM_NEAREST_SERVER,
LB_ALGORITHM_CORE_AFFINITY, LB_ALGORITHM_TOPOLOGY.
Default value when not specified in API or module is interpreted by Avi Controller as LB_ALGORITHM_LEAST_CONNECTIONS.

lb_algorithm_consistent_hash_hdr - |  | Http header name to be used for the hash key.
lb_algorithm_core_nonaffinity - added in 2.4 |  | Degree of non-affinity for core affinity based server selection. Allowed values are 1-65535. Field introduced in 17.1.3. Default value when not specified in API or module is interpreted by Avi Controller as 2.

lb_algorithm_hash
-

Criteria used as a key for determining the hash between the client and server.
Enum options - LB_ALGORITHM_CONSISTENT_HASH_SOURCE_IP_ADDRESS, LB_ALGORITHM_CONSISTENT_HASH_SOURCE_IP_ADDRESS_AND_PORT,
LB_ALGORITHM_CONSISTENT_HASH_URI, LB_ALGORITHM_CONSISTENT_HASH_CUSTOM_HEADER, LB_ALGORITHM_CONSISTENT_HASH_CUSTOM_STRING,
LB_ALGORITHM_CONSISTENT_HASH_CALLID.
Default value when not specified in API or module is interpreted by Avi Controller as LB_ALGORITHM_CONSISTENT_HASH_SOURCE_IP_ADDRESS.

lookup_server_by_name
boolean
added in 2.5

Choices:
- no
- yes

Allow server lookup by name.
Field introduced in 17.1.11,17.2.4.
Default value when not specified in API or module is interpreted by Avi Controller as False.

max_concurrent_connections_per_server - |  | The maximum number of concurrent connections allowed to each server within the pool. Note applied value will be no less than the number of service engines that the pool is placed on. If set to 0, no limit is applied. Default value when not specified in API or module is interpreted by Avi Controller as 0.
max_conn_rate_per_server - |  | Rate limit connections to each server.
min_health_monitors_up - added in 2.9 |  | Minimum number of health monitors in up state to mark server up. Field introduced in 18.2.1, 17.2.12.
min_servers_up - added in 2.9 |  | Minimum number of servers in up state for marking the pool up. Field introduced in 18.2.1, 17.2.12.
name - / required |  | The name of the pool.
networks - |  | (internal-use) networks designated as containing servers for this pool. The servers may be further narrowed down by a filter. This field is used internally by avi, not editable by the user.
nsx_securitygroup - |  | A list of nsx service groups where the servers for the pool are created. Field introduced in 17.1.1.
password string | Default: "" | Password of Avi user in Avi controller. The default value is the environment variable `AVI_PASSWORD`.
pki_profile_ref - |  | Avi will validate the ssl certificate present by a server against the selected pki profile. It is a reference to an object of type pkiprofile.
placement_networks - |  | Manually select the networks and subnets used to provide reachability to the pool's servers. Specify the subnet using the following syntax 10-1-1-0/24. Use static routes in vrf configuration when pool servers are not directly connected butroutable from the service engine.
prst_hdr_name - |  | Header name for custom header persistence. Field deprecated in 18.1.2.
request_queue_depth - |  | Minimum number of requests to be queued when pool is full. Default value when not specified in API or module is interpreted by Avi Controller as 128.

request_queue_enabled
boolean

Choices:
- no
- yes

Enable request queue when pool is full.
Default value when not specified in API or module is interpreted by Avi Controller as False.

rewrite_host_header_to_server_name
boolean

Choices:
- no
- yes

Rewrite incoming host header to server name of the server to which the request is proxied.
Enabling this feature rewrites host header for requests to all servers in the pool.
Default value when not specified in API or module is interpreted by Avi Controller as False.

rewrite_host_header_to_sni
boolean

Choices:
- no
- yes

If sni server name is specified, rewrite incoming host header to the sni server name.
Default value when not specified in API or module is interpreted by Avi Controller as False.

server_auto_scale
boolean

Choices:
- no
- yes

Server autoscale.
Not used anymore.
Field deprecated in 18.1.2.

server_count - |  | Field deprecated in 18.2.1.
server_name - |  | Fully qualified dns hostname which will be used in the tls sni extension in server connections if sni is enabled. If no value is specified, avi will use the incoming host header instead.
server_reselect - |  | Server reselect configuration for http requests.

server_timeout
-
added in 2.9

Server timeout value specifies the time within which a server connection needs to be established and a request-response exchange completes
between avi and the server.
Value of 0 results in using default timeout of 60 minutes.
Allowed values are 0-3600000.
Field introduced in 18.1.5,18.2.1.
Default value when not specified in API or module is interpreted by Avi Controller as 0.

servers - |  | The pool directs load balanced traffic to this list of destination servers. The servers can be configured by ip address, name, network or via ip address group.
service_metadata - added in 2.9 |  | Metadata pertaining to the service provided by this pool. In openshift/kubernetes environments, app metadata info is stored. Any user input to this field will be overwritten by avi vantage. Field introduced in 17.2.14,18.1.5,18.2.1.

sni_enabled
boolean

Choices:
- no
- yes

Enable tls sni for server connections.
If disabled, avi will not send the sni extension as part of the handshake.
Default value when not specified in API or module is interpreted by Avi Controller as True.

ssl_key_and_certificate_ref - |  | Service engines will present a client ssl certificate to the server. It is a reference to an object of type sslkeyandcertificate.
ssl_profile_ref - |  | When enabled, avi re-encrypts traffic to the backend servers. The specific ssl profile defines which ciphers and ssl versions will be supported. It is a reference to an object of type sslprofile.

state
-

Choices:
- absent
- present ←

The state that should be applied on the entity.

tenant string | Default: "admin" | Name of tenant used for all Avi API calls and context of object.
tenant_ref - |  | It is a reference to an object of type tenant.
tenant_uuid string | Default: "" | UUID of tenant used for all Avi API calls and context of object.
url - |  | Avi controller URL of the object.

use_service_port
boolean

Choices:
- no
- yes

Do not translate the client's destination port when sending the connection to the server.
The pool or servers specified service port will still be used for health monitoring.
Default value when not specified in API or module is interpreted by Avi Controller as False.

username string | Default: "" | Username used for accessing Avi controller. The default value is the environment variable `AVI_USERNAME`.
uuid - |  | Uuid of the pool.
vrf_ref - |  | Virtual routing context that the pool is bound to. This is used to provide the isolation of the set of networks the pool is attached to. The pool inherits the virtual routing context of the virtual service, and this field is used only internally, and is set by pb-transform. It is a reference to an object of type vrfcontext.

## Notes

Note

- For more information on using Ansible to manage Avi Network devices see https://www.ansible.com/ansible-avi-networks.

## Examples

    - name: Create a Pool with two servers and HTTP monitor
      avi_pool:
        controller: 10.10.1.20
        username: avi_user
        password: avi_password
        name: testpool1
        description: testpool1
        state: present
        health_monitor_refs:
            - '/api/healthmonitor?name=System-HTTP'
        servers:
            - ip:
                addr: 10.10.2.20
                type: V4
            - ip:
                addr: 10.10.2.21
                type: V4

    - name: Patch pool with a single server using patch op and avi_credentials
      avi_pool:
        avi_api_update_method: patch
        avi_api_patch_op: delete
        avi_credentials: "{{avi_credentials}}"
        name: test-pool
        servers:
          - ip:
            addr: 10.90.64.13
            type: 'V4'
      register: pool
      when:
        - state | default("present") == "present"

## Return Values

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

Key | Returned | Description
--- | --- | ---
obj dictionary | success, changed | Pool (api/pool) object

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Gaurav Rastogi (@grastogi23) <grastogi@avinetworks.com>

Hint

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