|
|
@ -24,16 +24,15 @@ description:
|
|
|
|
notify the health of the entire node to the cluster.
|
|
|
|
notify the health of the entire node to the cluster.
|
|
|
|
Service level checks do not require a check name or id as these are derived
|
|
|
|
Service level checks do not require a check name or id as these are derived
|
|
|
|
by Consul from the Service name and id respectively by appending 'service:'
|
|
|
|
by Consul from the Service name and id respectively by appending 'service:'
|
|
|
|
Node level checks require a check_name and optionally a check_id."
|
|
|
|
Node level checks require a I(check_name) and optionally a I(check_id)."
|
|
|
|
- Currently, there is no complete way to retrieve the script, interval or ttl
|
|
|
|
- Currently, there is no complete way to retrieve the script, interval or ttl
|
|
|
|
metadata for a registered check. Without this metadata it is not possible to
|
|
|
|
metadata for a registered check. Without this metadata it is not possible to
|
|
|
|
tell if the data supplied with ansible represents a change to a check. As a
|
|
|
|
tell if the data supplied with ansible represents a change to a check. As a
|
|
|
|
result this does not attempt to determine changes and will always report a
|
|
|
|
result this does not attempt to determine changes and will always report a
|
|
|
|
changed occurred. An api method is planned to supply this metadata so at that
|
|
|
|
changed occurred. An API method is planned to supply this metadata so at that
|
|
|
|
stage change management will be added.
|
|
|
|
stage change management will be added.
|
|
|
|
- "See http://consul.io for more details."
|
|
|
|
- "See U(http://consul.io) for more details."
|
|
|
|
requirements:
|
|
|
|
requirements:
|
|
|
|
- "python >= 2.6"
|
|
|
|
|
|
|
|
- python-consul
|
|
|
|
- python-consul
|
|
|
|
- requests
|
|
|
|
- requests
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
@ -42,96 +41,112 @@ options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- register or deregister the consul service, defaults to present
|
|
|
|
- register or deregister the consul service, defaults to present
|
|
|
|
required: true
|
|
|
|
default: present
|
|
|
|
choices: ['present', 'absent']
|
|
|
|
choices: ['present', 'absent']
|
|
|
|
service_name:
|
|
|
|
service_name:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Unique name for the service on a node, must be unique per node,
|
|
|
|
- Unique name for the service on a node, must be unique per node,
|
|
|
|
required if registering a service. May be omitted if registering
|
|
|
|
required if registering a service. May be omitted if registering
|
|
|
|
a node level check
|
|
|
|
a node level check
|
|
|
|
service_id:
|
|
|
|
service_id:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the ID for the service, must be unique per node, defaults to the
|
|
|
|
- the ID for the service, must be unique per node. If I(state=absent),
|
|
|
|
service name if the service name is supplied
|
|
|
|
defaults to the service name if supplied.
|
|
|
|
default: service_name if supplied
|
|
|
|
|
|
|
|
host:
|
|
|
|
host:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- host of the consul agent defaults to localhost
|
|
|
|
- host of the consul agent defaults to localhost
|
|
|
|
default: localhost
|
|
|
|
default: localhost
|
|
|
|
port:
|
|
|
|
port:
|
|
|
|
|
|
|
|
type: int
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the port on which the consul agent is running
|
|
|
|
- the port on which the consul agent is running
|
|
|
|
default: 8500
|
|
|
|
default: 8500
|
|
|
|
scheme:
|
|
|
|
scheme:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the protocol scheme on which the consul agent is running
|
|
|
|
- the protocol scheme on which the consul agent is running
|
|
|
|
default: http
|
|
|
|
default: http
|
|
|
|
version_added: "2.1"
|
|
|
|
version_added: "2.1"
|
|
|
|
validate_certs:
|
|
|
|
validate_certs:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- whether to verify the tls certificate of the consul agent
|
|
|
|
- whether to verify the TLS certificate of the consul agent
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'yes'
|
|
|
|
default: 'yes'
|
|
|
|
version_added: "2.1"
|
|
|
|
version_added: "2.1"
|
|
|
|
notes:
|
|
|
|
notes:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Notes to attach to check when registering it.
|
|
|
|
- Notes to attach to check when registering it.
|
|
|
|
service_port:
|
|
|
|
service_port:
|
|
|
|
|
|
|
|
type: int
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the port on which the service is listening. Can optionally be supplied for
|
|
|
|
- the port on which the service is listening. Can optionally be supplied for
|
|
|
|
registration of a service, i.e. if service_name or service_id is set
|
|
|
|
registration of a service, i.e. if I(service_name) or I(service_id) is set
|
|
|
|
service_address:
|
|
|
|
service_address:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the address to advertise that the service will be listening on.
|
|
|
|
- the address to advertise that the service will be listening on.
|
|
|
|
This value will be passed as the I(Address) parameter to Consul's
|
|
|
|
This value will be passed as the I(address) parameter to Consul's
|
|
|
|
U(/v1/agent/service/register) API method, so refer to the Consul API
|
|
|
|
U(/v1/agent/service/register) API method, so refer to the Consul API
|
|
|
|
documentation for further details.
|
|
|
|
documentation for further details.
|
|
|
|
version_added: "2.1"
|
|
|
|
version_added: "2.1"
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
|
|
|
|
type: list
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- a list of tags that will be attached to the service registration.
|
|
|
|
- tags that will be attached to the service registration.
|
|
|
|
script:
|
|
|
|
script:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the script/command that will be run periodically to check the health
|
|
|
|
- the script/command that will be run periodically to check the health
|
|
|
|
of the service. Scripts require an interval and vise versa
|
|
|
|
of the service. Scripts require I(interval) and vice versa.
|
|
|
|
interval:
|
|
|
|
interval:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the interval at which the service check will be run. This is a number
|
|
|
|
- the interval at which the service check will be run. This is a number
|
|
|
|
with a s or m suffix to signify the units of seconds or minutes e.g
|
|
|
|
with a s or m suffix to signify the units of seconds or minutes e.g
|
|
|
|
15s or 1m. If no suffix is supplied, m will be used by default e.g.
|
|
|
|
C(15s) or C(1m). If no suffix is supplied, m will be used by default e.g.
|
|
|
|
1 will be 1m. Required if the script param is specified.
|
|
|
|
C(1) will be C(1m). Required if the I(script) parameter is specified.
|
|
|
|
check_id:
|
|
|
|
check_id:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- an ID for the service check, defaults to the check name, ignored if
|
|
|
|
- an ID for the service check. If I(state=absent), defaults to
|
|
|
|
part of a service definition.
|
|
|
|
I(check_name). Ignored if part of a service definition.
|
|
|
|
check_name:
|
|
|
|
check_name:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- a name for the service check, defaults to the check id. required if
|
|
|
|
- a name for the service check. Required if standalone, ignored if
|
|
|
|
standalone, ignored if part of service definition.
|
|
|
|
part of service definition.
|
|
|
|
ttl:
|
|
|
|
ttl:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- checks can be registered with a ttl instead of a script and interval
|
|
|
|
- checks can be registered with a ttl instead of a I(script) and I(interval)
|
|
|
|
this means that the service will check in with the agent before the
|
|
|
|
this means that the service will check in with the agent before the
|
|
|
|
ttl expires. If it doesn't the check will be considered failed.
|
|
|
|
ttl expires. If it doesn't the check will be considered failed.
|
|
|
|
Required if registering a check and the script an interval are missing
|
|
|
|
Required if registering a check and the script an interval are missing
|
|
|
|
Similar to the interval this is a number with a s or m suffix to
|
|
|
|
Similar to the interval this is a number with a s or m suffix to
|
|
|
|
signify the units of seconds or minutes e.g 15s or 1m. If no suffix
|
|
|
|
signify the units of seconds or minutes e.g C(15s) or C(1m). If no suffix
|
|
|
|
is supplied, m will be used by default e.g. 1 will be 1m
|
|
|
|
is supplied, C(m) will be used by default e.g. C(1) will be C(1m)
|
|
|
|
http:
|
|
|
|
http:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- checks can be registered with an http endpoint. This means that consul
|
|
|
|
- checks can be registered with an HTTP endpoint. This means that consul
|
|
|
|
will check that the http endpoint returns a successful http status.
|
|
|
|
will check that the http endpoint returns a successful HTTP status.
|
|
|
|
Interval must also be provided with this option.
|
|
|
|
I(interval) must also be provided with this option.
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
|
timeout:
|
|
|
|
timeout:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- A custom HTTP check timeout. The consul default is 10 seconds.
|
|
|
|
- A custom HTTP check timeout. The consul default is 10 seconds.
|
|
|
|
Similar to the interval this is a number with a s or m suffix to
|
|
|
|
Similar to the interval this is a number with a C(s) or C(m) suffix to
|
|
|
|
signify the units of seconds or minutes, e.g. 15s or 1m.
|
|
|
|
signify the units of seconds or minutes, e.g. C(15s) or C(1m).
|
|
|
|
version_added: "2.0"
|
|
|
|
version_added: "2.0"
|
|
|
|
token:
|
|
|
|
token:
|
|
|
|
|
|
|
|
type: str
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- the token key indentifying an ACL rule set. May be required to register services.
|
|
|
|
- the token key identifying an ACL rule set. May be required to register services.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|