consul_kv: Fix name & formatting (#32132)
* Fix name & formatting * Fix examples
This commit is contained in:
parent
ca115b0a8e
commit
0e36854213
1 changed files with 18 additions and 16 deletions
|
@ -5,58 +5,60 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
DOCUMENTATION = """
|
DOCUMENTATION = """
|
||||||
lookup: cartesian
|
lookup: consul_kv
|
||||||
version_added: "1.9"
|
version_added: "1.9"
|
||||||
short_description: grab metadata from a consul key value store.
|
short_description: Fetch metadata from a Consul key value store.
|
||||||
description:
|
description:
|
||||||
- lookup metadata for a playbook from the key value store in a consul cluster.
|
- Lookup metadata for a playbook from the key value store in a Consul cluster.
|
||||||
Values can be easily set in the kv store with simple rest commands
|
Values can be easily set in the kv store with simple rest commands
|
||||||
- "curl -X PUT -d 'some-value' http://localhost:8500/v1/kv/ansible/somedata"
|
- C(curl -X PUT -d 'some-value' http://localhost:8500/v1/kv/ansible/somedata)
|
||||||
requirements:
|
requirements:
|
||||||
- 'python-consul (python library http://python-consul.readthedocs.org/en/latest/#installation)'
|
- 'python-consul python library U(http://python-consul.readthedocs.org/en/latest/#installation)'
|
||||||
options:
|
options:
|
||||||
_raw:
|
_raw:
|
||||||
description: key(s) to retrieve
|
description: List of key(s) to retrieve.
|
||||||
type: list
|
type: list
|
||||||
required: True
|
required: True
|
||||||
recurse:
|
recurse:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: if true, will retrieve all the values that have the given key as prefix
|
description: If true, will retrieve all the values that have the given key as prefix.
|
||||||
default: False
|
default: False
|
||||||
index:
|
index:
|
||||||
description: if the key has a value with the specified index then this is returned allowing access to historical values.
|
description: If the key has a value with the specified index then this is returned allowing access to historical values.
|
||||||
token:
|
token:
|
||||||
description: acl token to allow access to restricted values.
|
description: The acl token to allow access to restricted values.
|
||||||
host:
|
host:
|
||||||
default: localhost
|
default: localhost
|
||||||
description:
|
description:
|
||||||
- the target to connect to, must be a resolvable address.
|
- The target to connect to, must be a resolvable address.
|
||||||
env:
|
env:
|
||||||
- name: ANSIBLE_CONSUL_URL
|
- name: ANSIBLE_CONSUL_URL
|
||||||
port:
|
port:
|
||||||
description: the port of the target host to connect to.
|
description: The port of the target host to connect to.
|
||||||
default: 8500
|
default: 8500
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- debug: msg='key contains {{item}}'
|
- debug:
|
||||||
|
msg: 'key contains {{item}}'
|
||||||
with_consul_kv:
|
with_consul_kv:
|
||||||
- 'key/to/retrieve'
|
- 'key/to/retrieve'
|
||||||
|
|
||||||
- name: Parameters can be provided after the key be more specific about what to retrieve
|
- name: Parameters can be provided after the key be more specific about what to retrieve
|
||||||
debug: msg='key contains {{item}}'
|
debug:
|
||||||
|
msg: 'key contains {{item}}'
|
||||||
with_consul_kv:
|
with_consul_kv:
|
||||||
- 'key/to recurse=true token=E6C060A9-26FB-407A-B83E-12DDAFCB4D98')}}'
|
- 'key/to recurse=true token=E6C060A9-26FB-407A-B83E-12DDAFCB4D98'
|
||||||
|
|
||||||
- name: retrieving a KV from a remote cluster on non default port
|
- name: retrieving a KV from a remote cluster on non default port
|
||||||
debug:
|
debug:
|
||||||
msg: "{{ lookup('consul_kv', 'my/key', host='10.10.10.10', port='2000')
|
msg: "{{ lookup('consul_kv', 'my/key', host='10.10.10.10', port='2000') }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
_raw:
|
_raw:
|
||||||
description:
|
description:
|
||||||
- value(s) stored in consul
|
- Value(s) stored in consul.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
Loading…
Reference in a new issue