diff --git a/action.yml b/action.yml index c35442d..d30ddbf 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,9 @@ inputs: sudo: description: Set to "true" if root is required for running your playbook required: false +outputs: + output: + description: The captured output of both stdout and stderr from the Ansible Playbook run runs: using: node12 main: main.js diff --git a/main.js b/main.js index 81e200b..055fc18 100644 --- a/main.js +++ b/main.js @@ -81,7 +81,18 @@ async function main() { process.env.ANSIBLE_FORCE_COLOR = "True" - await exec.exec(cmd.join(' ')) + let output = "" + await exec.exec(cmd.join(' '), null, { + listeners: { + stdout: function(data) { + output += data.toString() + }, + stderr: function(data) { + output += data.toString() + } + } + }) + core.setOutput("output", output) } catch (error) { core.setFailed(error.message) }