Interact with Consul
salt.modules.consul.
acl_clone
(consul_url=None, **kwargs)¶Information about an ACL token.
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶Create a new ACL token.
参数: |
|
---|---|
返回: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.acl_create
salt.modules.consul.
acl_delete
(consul_url=None, **kwargs)¶Delete an ACL token.
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶Information about an ACL token.
参数: |
|
---|---|
返回: | Information about the ACL requested. |
CLI Example:
salt '*' consul.acl_info id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.
acl_list
(consul_url=None, **kwargs)¶List the ACL tokens.
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | List of ACLs |
CLI Example:
salt '*' consul.acl_list
salt.modules.consul.
acl_update
(consul_url=None, **kwargs)¶Update an ACL token.
参数: |
|
---|---|
返回: | Boolean & message of success or failure. |
CLI Example:
salt '*' consul.acl_update
salt.modules.consul.
agent_check_deregister
(consul_url=None, checkid=None)¶The agent will take care of deregistering the check from the Catalog.
参数: |
|
---|---|
返回: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_check_deregister checkid='Memory Utilization'
salt.modules.consul.
agent_check_fail
(consul_url=None, checkid=None, **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.
参数: |
|
---|---|
返回: | 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=None, checkid=None, **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.
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶The register endpoint is used to add a new check to the local agent.
参数: |
|
---|---|
返回: | 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=None, checkid=None, **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.
参数: |
|
---|---|
返回: | 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=None)¶Returns the checks the local agent is managing
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | Returns the checks the local agent is managing |
CLI Example:
salt '*' consul.agent_checks
salt.modules.consul.
agent_join
(consul_url=None, address=None, **kwargs)¶Triggers the local agent to join a node
参数: |
|
---|---|
返回: | 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=None, node=None)¶Used to instruct the agent to force a node into the left state.
参数: |
|
---|---|
返回: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_leave node='web1.example.com'
salt.modules.consul.
agent_maintenance
(consul_url=None, **kwargs)¶Manages node maintenance mode
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶Returns the members as seen by the local serf agent
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | Returns the members as seen by the local serf agent |
CLI Example:
salt '*' consul.agent_members
salt.modules.consul.
agent_self
(consul_url=None)¶Returns the local node configuration
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | Returns the local node configuration |
CLI Example:
salt '*' consul.agent_self
salt.modules.consul.
agent_service_deregister
(consul_url=None, serviceid=None)¶Used to remove a service.
参数: |
|
---|---|
返回: | Boolean and message indicating success or failure. |
CLI Example:
salt '*' consul.agent_service_deregister serviceid='redis'
salt.modules.consul.
agent_service_maintenance
(consul_url=None, serviceid=None, **kwargs)¶Used to place a service into maintenance mode.
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶The used to add a new service, with an optional health check, to the local agent.
参数: |
|
---|---|
返回: | 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=None)¶Returns the services the local agent is managing
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | Returns the services the local agent is managing |
CLI Example:
salt '*' consul.agent_services
salt.modules.consul.
catalog_datacenters
(consul_url=None)¶Return list of available datacenters from catalog.
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | The list of available datacenters. |
CLI Example:
salt '*' consul.catalog_datacenters
salt.modules.consul.
catalog_deregister
(consul_url=None, **kwargs)¶Deregisters a node, service, or check
参数: |
|
---|---|
返回: | 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=None, node=None, **kwargs)¶Information about the registered node.
参数: |
|
---|---|
返回: | Information about the requested node. |
CLI Example:
salt '*' consul.catalog_service service='redis'
salt.modules.consul.
catalog_nodes
(consul_url=None, **kwargs)¶Return list of available nodes from catalog.
参数: |
|
---|---|
返回: | The list of available nodes. |
CLI Example:
salt '*' consul.catalog_nodes
salt.modules.consul.
catalog_register
(consul_url=None, **kwargs)¶Registers a new node, service, or check
参数: |
|
---|---|
返回: | 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=None, service=None, **kwargs)¶Information about the registered service.
参数: |
|
---|---|
返回: | Information about the requested service. |
CLI Example:
salt '*' consul.catalog_service service='redis'
salt.modules.consul.
catalog_services
(consul_url=None, **kwargs)¶Return list of available services rom catalog.
参数: |
|
---|---|
返回: | The list of available services. |
CLI Example:
salt '*' consul.catalog_services
salt.modules.consul.
delete
(consul_url=None, key=None, **kwargs)¶Delete values from Consul
参数: |
|
---|---|
返回: | 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=None, name=None, **kwargs)¶List the ACL tokens.
参数: |
|
---|---|
返回: | List of ACLs |
CLI Example:
salt '*' consul.event_fire name='deploy'
salt.modules.consul.
event_list
(consul_url=None, **kwargs)¶List the recent events.
参数: |
|
---|---|
返回: | List of ACLs |
CLI Example:
salt '*' consul.event_list
salt.modules.consul.
get
(consul_url=None, key=None, recurse=False, decode=False, raw=False)¶Get key from Consul
参数: |
|
---|---|
返回: | 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=None, service=None, **kwargs)¶Health information about the registered service.
参数: |
|
---|---|
返回: | Health information about the requested node. |
CLI Example:
salt '*' consul.health_checks service='redis1'
salt.modules.consul.
health_node
(consul_url=None, node=None, **kwargs)¶Health information about the registered node.
参数: |
|
---|---|
返回: | Health information about the requested node. |
CLI Example:
salt '*' consul.health_node node='node1'
salt.modules.consul.
health_service
(consul_url=None, service=None, **kwargs)¶Health information about the registered service.
参数: |
|
---|---|
返回: | 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=None, state=None, **kwargs)¶Returns the checks in the state provided on the path.
参数: |
|
---|---|
返回: | The checks in the provided state. |
CLI Example:
salt '*' consul.health_state state='redis1'
salt '*' consul.health_state service='redis1' passing='True'
salt.modules.consul.
list
(consul_url=None, key=None, **kwargs)¶List keys in Consul
参数: |
|
---|---|
返回: | The list of keys. |
CLI Example:
salt '*' consul.list
salt '*' consul.list key='web'
salt.modules.consul.
put
(consul_url=None, key=None, value=None, **kwargs)¶Put values into Consul
参数: |
|
---|---|
返回: | 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=None, **kwargs)¶Used to create a session.
参数: |
|
---|---|
返回: | 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=None, session=None, **kwargs)¶Destroy session
参数: |
|
---|---|
返回: | 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=None, session=None, **kwargs)¶Information about a session
参数: |
|
---|---|
返回: | 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=None, return_list=False, **kwargs)¶Used to list sessions.
参数: |
|
---|---|
返回: | A list of all available sessions. |
CLI Example:
salt '*' consul.session_list
salt.modules.consul.
status_leader
(consul_url=None)¶Returns the current Raft leader
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | 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
参数: | consul_url -- The Consul server URL. |
---|---|
返回: | Retrieves the Raft peers for the datacenter in which the the agent is running. |
CLI Example:
salt '*' consul.status_peers