mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 23:14:02 -07:00
c*.py: normalize docs (#9418)
* c*.py: normalize docs * fix copy/paste mistake * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
912065ad0e
commit
43599c6850
36 changed files with 1437 additions and 1614 deletions
|
@ -10,15 +10,14 @@ from __future__ import absolute_import, division, print_function
|
|||
__metaclass__ = type
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = r"""
|
||||
module: consul_kv
|
||||
short_description: Manipulate entries in the key/value store of a consul cluster
|
||||
short_description: Manipulate entries in the key/value store of a Consul cluster
|
||||
description:
|
||||
- Allows the retrieval, addition, modification and deletion of key/value entries in a
|
||||
consul cluster via the agent. The entire contents of the record, including
|
||||
the indices, flags and session are returned as C(value).
|
||||
- If the O(key) represents a prefix then note that when a value is removed, the existing
|
||||
value if any is returned as part of the results.
|
||||
- Allows the retrieval, addition, modification and deletion of key/value entries in a Consul cluster using the agent. The
|
||||
entire contents of the record, including the indices, flags and session are returned as C(value).
|
||||
- If the O(key) represents a prefix then note that when a value is removed, the existing value if any is returned as part
|
||||
of the results.
|
||||
- See http://www.consul.io/docs/agent/http.html#kv for more details.
|
||||
requirements:
|
||||
- python-consul
|
||||
|
@ -29,98 +28,89 @@ author:
|
|||
extends_documentation_fragment:
|
||||
- community.general.attributes
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: none
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: none
|
||||
options:
|
||||
state:
|
||||
description:
|
||||
- The action to take with the supplied key and value. If the state is V(present) and O(value) is set, the key
|
||||
contents will be set to the value supplied and C(changed) will be set to V(true) only if the value was
|
||||
different to the current contents. If the state is V(present) and O(value) is not set, the existing value
|
||||
associated to the key will be returned. The state V(absent) will remove the key/value pair,
|
||||
again C(changed) will be set to V(true) only if the key actually existed
|
||||
prior to the removal. An attempt can be made to obtain or free the
|
||||
lock associated with a key/value pair with the states V(acquire) or
|
||||
V(release) respectively. a valid session must be supplied to make the
|
||||
attempt changed will be true if the attempt is successful, false
|
||||
otherwise.
|
||||
type: str
|
||||
choices: [ absent, acquire, present, release ]
|
||||
default: present
|
||||
key:
|
||||
description:
|
||||
- The key at which the value should be stored.
|
||||
type: str
|
||||
required: true
|
||||
value:
|
||||
description:
|
||||
- The value should be associated with the given key, required if O(state)
|
||||
is V(present).
|
||||
type: str
|
||||
recurse:
|
||||
description:
|
||||
- If the key represents a prefix, each entry with the prefix can be
|
||||
retrieved by setting this to V(true).
|
||||
type: bool
|
||||
retrieve:
|
||||
description:
|
||||
- If the O(state) is V(present) and O(value) is set, perform a
|
||||
read after setting the value and return this value.
|
||||
default: true
|
||||
type: bool
|
||||
session:
|
||||
description:
|
||||
- The session that should be used to acquire or release a lock
|
||||
associated with a key/value pair.
|
||||
type: str
|
||||
token:
|
||||
description:
|
||||
- The token key identifying an ACL rule set that controls access to
|
||||
the key value pair
|
||||
type: str
|
||||
cas:
|
||||
description:
|
||||
- Used when acquiring a lock with a session. If the O(cas) is V(0), then
|
||||
Consul will only put the key if it does not already exist. If the
|
||||
O(cas) value is non-zero, then the key is only set if the index matches
|
||||
the ModifyIndex of that key.
|
||||
type: str
|
||||
flags:
|
||||
description:
|
||||
- Opaque positive integer value that can be passed when setting a value.
|
||||
type: str
|
||||
host:
|
||||
description:
|
||||
- Host of the consul agent.
|
||||
type: str
|
||||
default: localhost
|
||||
port:
|
||||
description:
|
||||
- The port on which the consul agent is running.
|
||||
type: int
|
||||
default: 8500
|
||||
scheme:
|
||||
description:
|
||||
- The protocol scheme on which the consul agent is running.
|
||||
type: str
|
||||
default: http
|
||||
validate_certs:
|
||||
description:
|
||||
- Whether to verify the tls certificate of the consul agent.
|
||||
type: bool
|
||||
default: true
|
||||
datacenter:
|
||||
description:
|
||||
- The name of the datacenter to query. If unspecified, the query will default
|
||||
to the datacenter of the Consul agent on O(host).
|
||||
type: str
|
||||
version_added: 10.0.0
|
||||
'''
|
||||
state:
|
||||
description:
|
||||
- The action to take with the supplied key and value. If the state is V(present) and O(value) is set, the key contents
|
||||
will be set to the value supplied and C(changed) will be set to V(true) only if the value was different to the current
|
||||
contents. If the state is V(present) and O(value) is not set, the existing value associated to the key will be returned.
|
||||
The state V(absent) will remove the key/value pair, again C(changed) will be set to V(true) only if the key actually
|
||||
existed prior to the removal. An attempt can be made to obtain or free the lock associated with a key/value pair with
|
||||
the states V(acquire) or V(release) respectively. A valid session must be supplied to make the attempt C(changed) will
|
||||
be V(true) if the attempt is successful, V(false) otherwise.
|
||||
type: str
|
||||
choices: [absent, acquire, present, release]
|
||||
default: present
|
||||
key:
|
||||
description:
|
||||
- The key at which the value should be stored.
|
||||
type: str
|
||||
required: true
|
||||
value:
|
||||
description:
|
||||
- The value should be associated with the given key, required if O(state) is V(present).
|
||||
type: str
|
||||
recurse:
|
||||
description:
|
||||
- If the key represents a prefix, each entry with the prefix can be retrieved by setting this to V(true).
|
||||
type: bool
|
||||
retrieve:
|
||||
description:
|
||||
- If the O(state) is V(present) and O(value) is set, perform a read after setting the value and return this value.
|
||||
default: true
|
||||
type: bool
|
||||
session:
|
||||
description:
|
||||
- The session that should be used to acquire or release a lock associated with a key/value pair.
|
||||
type: str
|
||||
token:
|
||||
description:
|
||||
- The token key identifying an ACL rule set that controls access to the key value pair.
|
||||
type: str
|
||||
cas:
|
||||
description:
|
||||
- Used when acquiring a lock with a session. If the O(cas) is V(0), then Consul will only put the key if it does not
|
||||
already exist. If the O(cas) value is non-zero, then the key is only set if the index matches the ModifyIndex of that
|
||||
key.
|
||||
type: str
|
||||
flags:
|
||||
description:
|
||||
- Opaque positive integer value that can be passed when setting a value.
|
||||
type: str
|
||||
host:
|
||||
description:
|
||||
- Host of the Consul agent.
|
||||
type: str
|
||||
default: localhost
|
||||
port:
|
||||
description:
|
||||
- The port on which the Consul agent is running.
|
||||
type: int
|
||||
default: 8500
|
||||
scheme:
|
||||
description:
|
||||
- The protocol scheme on which the Consul agent is running.
|
||||
type: str
|
||||
default: http
|
||||
validate_certs:
|
||||
description:
|
||||
- Whether to verify the tls certificate of the Consul agent.
|
||||
type: bool
|
||||
default: true
|
||||
datacenter:
|
||||
description:
|
||||
- The name of the datacenter to query. If unspecified, the query will default to the datacenter of the Consul agent
|
||||
on O(host).
|
||||
type: str
|
||||
version_added: 10.0.0
|
||||
"""
|
||||
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r"""
|
||||
# If the key does not exist, the value associated to the "data" property in `retrieved_key` will be `None`
|
||||
# If the key value is empty string, `retrieved_key["data"]["Value"]` will be `None`
|
||||
- name: Retrieve a value from the key/value store
|
||||
|
@ -138,7 +128,7 @@ EXAMPLES = '''
|
|||
key: somekey
|
||||
state: absent
|
||||
|
||||
- name: Add a node to an arbitrary group via consul inventory (see consul.ini)
|
||||
- name: Add a node to an arbitrary group using Consul inventory (see consul.ini)
|
||||
community.general.consul_kv:
|
||||
key: ansible/groups/dc1/somenode
|
||||
value: top_secret
|
||||
|
@ -149,7 +139,7 @@ EXAMPLES = '''
|
|||
value: 20160509
|
||||
session: "{{ sessionid }}"
|
||||
state: acquire
|
||||
'''
|
||||
"""
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue