1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2025-04-22 07:43:35 +00:00

Consolidate stdout and stderr into single output

This commit is contained in:
Brooks Swinnerton 2021-07-30 21:50:09 -04:00
parent 7e6cacac83
commit d8a8e9121d
No known key found for this signature in database
GPG key ID: 72743B7DE552E25A
2 changed files with 6 additions and 10 deletions

View file

@ -32,10 +32,8 @@ inputs:
description: Set to "true" if root is required for running your playbook
required: false
outputs:
stdout:
description: The captured output of stdout from the Ansible Playbook run
stderr:
description: The captured output of stderr from the Ansible Playbook run
output:
description: The captured output of both stdout and stderr from the Ansible Playbook run
runs:
using: node12
main: main.js

10
main.js
View file

@ -81,21 +81,19 @@ async function main() {
process.env.ANSIBLE_FORCE_COLOR = "True"
let stdout = ''
let stderr = ''
let output = ''
const execOptions = {}
execOptions.listeners = {
stdout: function(data) {
stdout += data.toString()
output += data.toString()
},
stderr: function(data) {
stderr += data.toString()
output += data.toString()
}
}
await exec.exec("ansible-playbook", cmd, execOptions)
core.setOutput('stdout', stdout)
core.setOutput('stderr', stderr)
core.setOutput('output', output)
} catch (error) {
core.setFailed(error.message)
}