Interact with Consul
salt.modules.consul.
acl_clone
(consul_url, **kwargs)¶Information about an ACL token.
Parameters: |
|
---|---|
Returns: | Boolean, message of success or failure, and new ID of cloned ACL. |
CLI Example:
salt '*' consul.acl_info id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
acl_create
(consul_url, **kwargs)¶Create a new ACL token.
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.acl_create
salt.modules.consul.
acl_delete
(consul_url, **kwargs)¶Delete an ACL token.
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.acl_delete id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
acl_info
(consul_url, **kwargs)¶Information about an ACL token.
Parameters: |
|
---|---|
Returns: | Information about the ACL requested. |
CLI Example:
salt '*' consul.acl_info id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
acl_list
(consul_url, **kwargs)¶List the ACL tokens.
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | List of ACLs |
CLI Example:
salt '*' consul.acl_list
salt.modules.consul.
acl_update
(consul_url, **kwargs)¶Update an ACL token.
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.acl_update
salt.modules.consul.
agent_check_deregister
(consul_url, checkid)¶The agent will take care of deregistering the check from the Catalog.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_register name='Memory Utilization'
script='/usr/local/bin/check_mem.py' interval='15s'
salt.modules.consul.
agent_check_fail
(consul_url, checkid, **kwargs)¶This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to critical and the TTL clock is reset.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_fail checkid='redis_check1'
note='Forcing check into critical state.'
salt.modules.consul.
agent_check_pass
(consul_url, checkid, **kwargs)¶This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to passing and the TTL clock is reset.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_pass checkid='redis_check1'
note='Forcing check into passing state.'
salt.modules.consul.
agent_check_register
(consul_url, **kwargs)¶The register endpoint is used to add a new check to the local agent.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_register name='Memory Utilization'
script='/usr/local/bin/check_mem.py' interval='15s'
salt.modules.consul.
agent_check_warn
(consul_url, checkid, **kwargs)¶This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to warning and the TTL clock is reset.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_warn checkid='redis_check1'
note='Forcing check into warning state.'
salt.modules.consul.
agent_checks
(consul_url)¶Returns the checks the local agent is managing
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | Returns the checks the local agent is managing |
CLI Example:
salt '*' consul.agent_checks
salt.modules.consul.
agent_join
(consul_url, address, **kwargs)¶Triggers the local agent to join a node
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_join address='192.168.1.1'
salt.modules.consul.
agent_leave
(consul_url, node)¶Used to instruct the agent to force a node into the left state.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_leave node='web1.example.com'
salt.modules.consul.
agent_maintenance
(consul_url, **kwargs)¶Manages node maintenance mode
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_maintenance enable='False' reason='Upgrade in progress'
salt.modules.consul.
agent_members
(consul_url, **kwargs)¶Returns the members as seen by the local serf agent
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | Returns the members as seen by the local serf agent |
CLI Example:
salt '*' consul.agent_members
salt.modules.consul.
agent_self
(consul_url)¶Returns the local node configuration
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | Returns the local node configuration |
CLI Example:
salt '*' consul.agent_self
salt.modules.consul.
agent_service_deregister
(consul_url, serviceid)¶Used to remove a service.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_service_deregister serviceid='redis'
salt.modules.consul.
agent_service_maintenance
(consul_url, serviceid, **kwargs)¶Used to place a service into maintenance mode.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_service_deregister serviceid='redis'
enable='True' reason='Down for upgrade'
salt.modules.consul.
agent_service_register
(consul_url, **kwargs)¶The used to add a new service, with an optional health check, to the local agent.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_service_register name='redis'
tags='["master", "v1"]' address="127.0.0.1" port="8080"
check_script="/usr/local/bin/check_redis.py" interval="10s"
salt.modules.consul.
agent_services
(consul_url)¶Returns the services the local agent is managing
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | Returns the services the local agent is managing |
CLI Example:
salt '*' consul.agent_services
salt.modules.consul.
catalog_datacenters
(consul_url)¶Return list of available datacenters from catalog.
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | The list of available datacenters. |
CLI Example:
salt '*' consul.catalog_datacenters
salt.modules.consul.
catalog_deregister
(consul_url, **kwargs)¶Deregisters a node, service, or check
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.catalog_register node='node1'
serviceid='redis_server1' checkid='redis_check1'
salt.modules.consul.
catalog_node
(consul_url, node, **kwargs)¶Information about the registered node.
Parameters: |
|
---|---|
Returns: | Information about the requested node. |
CLI Example:
salt '*' consul.catalog_service service='redis'
salt.modules.consul.
catalog_nodes
(consul_url, **kwargs)¶Return list of available nodes from catalog.
Parameters: |
|
---|---|
Returns: | The list of available nodes. |
CLI Example:
salt '*' consul.catalog_nodes
salt.modules.consul.
catalog_register
(consul_url, **kwargs)¶Registers a new node, service, or check
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.catalog_register node='node1' address='192.168.1.1'
service='redis' service_address='127.0.0.1' service_port='8080'
service_id='redis_server1'
salt.modules.consul.
catalog_service
(consul_url, service, **kwargs)¶Information about the registered service.
Parameters: |
|
---|---|
Returns: | Information about the requested service. |
CLI Example:
salt '*' consul.catalog_service service='redis'
salt.modules.consul.
catalog_services
(consul_url, **kwargs)¶Return list of available services rom catalog.
Parameters: |
|
---|---|
Returns: | The list of available services. |
CLI Example:
salt '*' consul.catalog_services
salt.modules.consul.
delete
(consul_url, key, **kwargs)¶Delete values from Consul
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.delete key='web'
salt '*' consul.delete key='web' recurse='True'
salt.modules.consul.
event_fire
(consul_url, name, **kwargs)¶List the ACL tokens.
Parameters: |
|
---|---|
Returns: | List of ACLs |
CLI Example:
salt '*' consul.event_fire name='deploy'
salt.modules.consul.
event_list
(consul_url, **kwargs)¶List the recent events.
Parameters: |
|
---|---|
Returns: | List of ACLs |
CLI Example:
salt '*' consul.event_list
salt.modules.consul.
get
(consul_url, key, recurse=False, decode=False, raw=False)¶Get key from Consul
Parameters: |
|
---|---|
Returns: | The keys in Consul. |
CLI Example:
salt '*' consul.get key='web/key1'
salt '*' consul.list key='web' recurse='True
salt '*' consul.list key='web' recurse='True' decode='True'
By default values stored in Consul are base64 encoded, passing the
decode option will show them as the decoded values.
salt '*' consul.list key='web' recurse='True' decode='True' raw='True'
By default Consult will return other information about the key, the raw
option will return only the raw value.
salt.modules.consul.
health_checks
(consul_url, service, **kwargs)¶Health information about the registered service.
Parameters: |
|
---|---|
Returns: | Health information about the requested node. |
CLI Example:
salt '*' consul.health_checks service='redis1'
salt.modules.consul.
health_node
(consul_url, node, **kwargs)¶Health information about the registered node.
Parameters: |
|
---|---|
Returns: | Health information about the requested node. |
CLI Example:
salt '*' consul.health_node node='node1'
salt.modules.consul.
health_service
(consul_url, service, **kwargs)¶Health information about the registered service.
Parameters: |
|
---|---|
Returns: | Health information about the requested node. |
CLI Example:
salt '*' consul.health_service service='redis1'
salt '*' consul.health_service service='redis1' passing='True'
salt.modules.consul.
health_state
(consul_url, state, **kwargs)¶Returns the checks in the state provided on the path.
Parameters: |
|
---|---|
Returns: | The checks in the provided state. |
CLI Example:
salt '*' consul.health_service service='redis1'
salt '*' consul.health_service service='redis1' passing='True'
salt.modules.consul.
list
(consul_url, key=None, **kwargs)¶List keys in Consul
Parameters: |
|
---|---|
Returns: | The list of keys. |
CLI Example:
salt '*' consul.list
salt '*' consul.list key='web'
salt.modules.consul.
put
(consul_url, key, value, **kwargs)¶Put values into Consul
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.put key='web/key1' value="Hello there"
salt '*' consul.put key='web/key1' value="Hello there"
acquire='d5d371f4-c380-5280-12fd-8810be175592'
salt '*' consul.put key='web/key1' value="Hello there"
release='d5d371f4-c380-5280-12fd-8810be175592'
salt.modules.consul.
session_create
(consul_url, **kwargs)¶Used to create a session.
Parameters: |
|
---|---|
Returns: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.session_create node='node1' name='my-session'
behavior='delete' ttl='3600s'
salt.modules.consul.
session_destroy
(consul_url, session, **kwargs)¶Destroy session
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.session_destroy session='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
session_info
(consul_url, session, **kwargs)¶Information about a session
Parameters: |
|
---|---|
Returns: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.session_info session='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
session_list
(consul_url, return_list=False, **kwargs)¶Used to list sessions.
Parameters: |
|
---|---|
Returns: | A list of all available sessions. |
CLI Example:
salt '*' consul.session_list
salt.modules.consul.
status_leader
(consul_url)¶Returns the current Raft leader
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | The address of the Raft leader. |
CLI Example:
salt '*' consul.status_leader
salt.modules.consul.
status_peers
(consul_url)¶Returns the current Raft peer set
Parameters: | consul_url -- The Consul server URL. |
---|---|
Returns: | Retrieves the Raft peers for the datacenter in which the the agent is running. |
CLI Example:
salt '*' consul.status_peers