Provide helpful return output on ara_record tasks
There's no good reason why ara_record would only return a status message. It'd be much more helpful if it returned the same thing as ara_read so let's do that. Change-Id: I46d511dd39136da96afa75b447d86acd58aaf86e
This commit is contained in:
parent
a72ece2e7a
commit
58e875cc9d
|
@ -78,9 +78,16 @@ EXAMPLES = """
|
|||
register: git_version
|
||||
delegate_to: localhost
|
||||
|
||||
# Registering the result of an ara_record task is equivalent to doing an
|
||||
# ara_read on the key
|
||||
- ara_record:
|
||||
key: "git_version"
|
||||
value: "{{ git_version.stdout }}"
|
||||
register: version
|
||||
|
||||
- name: Print recorded data
|
||||
debug:
|
||||
msg: "{{ version.playbook_id}} - {{ version.key }}: {{ version.value }}
|
||||
|
||||
# Write data with a type (otherwise defaults to "text")
|
||||
# This changes the behavior on how the value is presented in the web interface
|
||||
|
@ -177,6 +184,10 @@ class ActionModule(ActionBase):
|
|||
|
||||
try:
|
||||
self.create_or_update_key(playbook_id, key, value, type)
|
||||
result['key'] = key
|
||||
result['value'] = value
|
||||
result['type'] = type
|
||||
result['playbook_id'] = playbook_id
|
||||
result['msg'] = 'Data recorded in ARA for this playbook.'
|
||||
except Exception as e:
|
||||
result['failed'] = True
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
ara_record:
|
||||
key: "notype"
|
||||
value: "text"
|
||||
|
||||
- name: Read notype key
|
||||
ara_read:
|
||||
key: "notype"
|
||||
register: notype
|
||||
|
||||
- name: Validate notype key
|
||||
|
|
|
@ -31,10 +31,17 @@ order to register whatever you'd like in a key/value format, for example::
|
|||
command: git rev-parse HEAD
|
||||
register: git_version
|
||||
|
||||
# Registering the result of an ara_record tasks is equivalent to
|
||||
# doing an ara_read on the key
|
||||
- name: Record git version
|
||||
ara_record:
|
||||
key: "git_version"
|
||||
value: "{{ git_version.stdout }}"
|
||||
register: version
|
||||
|
||||
- name: Print recorded data
|
||||
debug:
|
||||
msg: "{{ version.playbook_id}} - {{ version.key }}: {{ version.value }}
|
||||
|
||||
It also supports data types which will have an impact on how the value will be
|
||||
displayed in the web interface. The default type if not specified is "text".
|
||||
|
|
Loading…
Reference in New Issue