summaryrefslogtreecommitdiff
path: root/clustering/consul_session.py
diff options
context:
space:
mode:
authorIan Levesque <irlevesque@gmail.com>2016-06-13 14:50:19 -0400
committerAdrian Likins <alikins@redhat.com>2016-06-13 14:50:19 -0400
commit88dc108b690e6005f7a4f7ba5ff8049328200342 (patch)
tree699ebff85e97a59a8a9342f58e4958165334c10c /clustering/consul_session.py
parent2ad6f02c7b23d2ebe3a815328e06e88a0f4a5b33 (diff)
downloadansible-modules-extras-88dc108b690e6005f7a4f7ba5ff8049328200342.tar.gz
add 'behavior' attribute to consul_session (#2183)
add 'behavior' attribute to consul_session
Diffstat (limited to 'clustering/consul_session.py')
-rw-r--r--clustering/consul_session.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/clustering/consul_session.py b/clustering/consul_session.py
index f0ebd11b..d2c24e12 100644
--- a/clustering/consul_session.py
+++ b/clustering/consul_session.py
@@ -100,6 +100,14 @@ options:
required: false
default: True
version_added: "2.1"
+ behavior:
+ description:
+ - the optional behavior that can be attached to the session when it
+ is created. This can be set to either ‘release’ or ‘delete’. This
+ controls the behavior when a session is invalidated.
+ default: release
+ required: false
+ version_added: "2.2"
"""
EXAMPLES = '''
@@ -188,6 +196,7 @@ def update_session(module):
checks = module.params.get('checks')
datacenter = module.params.get('datacenter')
node = module.params.get('node')
+ behavior = module.params.get('behavior')
consul_client = get_consul_api(module)
@@ -195,6 +204,7 @@ def update_session(module):
session = consul_client.session.create(
name=name,
+ behavior=behavior,
node=node,
lock_delay=validate_duration('delay', delay),
dc=datacenter,
@@ -203,6 +213,7 @@ def update_session(module):
module.exit_json(changed=True,
session_id=session,
name=name,
+ behavior=behavior,
delay=delay,
checks=checks,
node=node)
@@ -249,6 +260,8 @@ def main():
argument_spec = dict(
checks=dict(default=None, required=False, type='list'),
delay=dict(required=False,type='str', default='15s'),
+ behavior=dict(required=False,type='str', default='release',
+ choices=['release', 'delete']),
host=dict(default='localhost'),
port=dict(default=8500, type='int'),
scheme=dict(required=False, default='http'),