Skip to content

Instantly share code, notes, and snippets.

@nzlosh
Created December 1, 2017 14:16
Show Gist options
  • Save nzlosh/842957faa9f64b8efa6cde95439703c0 to your computer and use it in GitHub Desktop.
Save nzlosh/842957faa9f64b8efa6cde95439703c0 to your computer and use it in GitHub Desktop.
Logging action results to syslog
---
chain:
-
name: say_it
ref: core.local
parameters:
cmd: 'echo "{{ cmd }}"'
on-success: run_it
-
name: run_it
ref: core.local
parameters:
cmd: "{{ cmd }}"
default: say_it
---
description: Execute a logger and echo of a fixed message.
enabled: true
entry_point: 'chains/notify_by_syslog_json.yaml'
name: notify_by_syslog_json
runner_type: "action-chain"
notify:
on-complete:
routes:
- syslog
parameters:
cmd:
description: Arbitrary Linux command to be executed on the remote host(s).
required: true
type: string
Nov 30 15:55:34 localhost write_syslog[41557]:
Action core.local completed.
status : succeeded
execution: 5a201be2dc599aa0f328a92b
web_url: https://localhost/#/history/5a201be2dc599aa0f328a92b/general
Took 0.307441\u03BCs to complete.
result :
--------
stdout : date
Nov 30 15:55:35 localhost write_syslog[41581]:
Action core.local completed.
status : succeeded
execution: 5a201be3dc599aa0f328a934
web_url: https://localhost/#/history/5a201be3dc599aa0f328a934/general
Took 0.312612\u03BCs to complete.
result :
--------
stdout : Thu Nov 30 15:55:32 CET 2017
Nov 30 15:55:36 localhost write_syslog[41592]:
Action test.notify_by_syslog_json completed.
status : succeeded
execution: 5a201be2dc599aa1390e1895
web_url: https://localhost/#/history/5a201be2dc599aa1390e1895/general
Took 3s to complete.
result :
--------
tasks : [{u'liveaction_id': u'5a201be2dc599aa0f328a92a', u'workflow': None, u'created_at': u'2017-11-30T14:55:30.638047+00:00', u'updated_at': u'2017-11-30T14:55:31.749809+00:00', u'state': u'succeeded', u'result': {u'succeeded': True, u'failed': False, u'return_code': 0, u'stderr': u'', u'stdout': u'date'}, u'id': u'say_it', u'execution_id': u'5a201be2dc599aa0f328a92b', u'name': u'say_it'}, {u'liveaction_id': u'5a201be3dc599aa0f328a933', u'workflow': None, u'created_at': u'2017-11-30T14:55:31.777045+00:00', u'updated_at': u'2017-11-30T14:55:32.945583+00:00', u'state': u'succeeded', u'result': {u'succeeded': True, u'failed': False, u'return_code': 0, u'stderr': u'', u'stdout': u'Thu Nov 30 15:55:32 CET 2017'}, u'id': u'run_it', u'execution_id': u'5a201be3dc599aa0f328a934', u'name': u'run_it'}]
published :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment