PARALLAX

consul_session

Create, inspect or destroy Consul sessions

Collection: community.general

Full Name: community.general.consul_session

Synopsis

Create, inspect or destroy Consul sessions

Parameters

NameTypeRequiredDefaultDescription
behaviorstringreleaseThe optional behavior that can be attached to the session when it is created. This controls the behavior when a session is invalidated.
ca_pathstringTarget PEM CA bundle path.
checkslistChecks that are used to verify the session health. If all the checks fail, the session is invalidated and any locks associated with the session are released and can be acquired once the associated lock delay has expired.
datacenterstringThe name of the datacenter in which the session exists or should be created.
delayint15The optional lock delay that can be attached to the session when it is created. Locks for invalidated sessions ar blocked from being acquired until this delay has expired. Durations are in seconds.
hoststringlocalhostConsul agent hostname.
idstringID of the session, required when O(state) is either V(info) or V(remove).
namestringThe name that should be associated with the session. Required when O(state=node) is used.
nodestringThe name of the node that with which the session is associated. By default this is the name of the agent.
portint8500Consul agent HTTP port.
schemestringhttpHTTP or HTTPS protocol.
statestringpresentWhether the session should be present, in other words it should be created if it does not exist, or absent, removed if present. If created, the O(id) for the session is returned in the output. If V(absent), O(id) is required to remove the session. Info for a single session, all the sessions for a node or all available sessions can be retrieved by specifying V(info), V(node) or V(list) for the O(state); for V(node) or V(info), the node O(name) or session O(id) is required as parameter.
tokenstringConsul ACL token; private argument.
ttlintSpecifies the duration of a session in seconds (between 10 and 86400).
validate_certsbooltrueValidate the server certificate.

Example

yaml
- community.general.consul_session:
    name: session1
  name: Register basic session with Consul

- community.general.consul_session:
    checks:
        - existing_check_name
    name: session_with_check
  name: Register a session with an existing check

- community.general.consul_session:
    delay: 20
    name: session_with_delay
  name: Register a session with lock_delay

- community.general.consul_session:
    id: session_id
    state: info
  name: Retrieve info about session by id

- community.general.consul_session:
    state: list
  name: Retrieve active sessions

- community.general.consul_session:
    name: session-with-ttl
    ttl: 600
  name: Register session with a ttl
Search
    ↑ ↓ move↵ openesc close