1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2025-04-22 15:53:36 +00:00

Merge branch 'master' into option-to-control-colored-output

This commit is contained in:
Brooks Swinnerton 2021-08-01 10:49:48 -04:00 committed by GitHub
commit 126c42dd51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -34,6 +34,9 @@ inputs:
no_color:
description: Set to "true" if the Ansible output should not include colors (defaults to "false")
required: false
outputs:
output:
description: The captured output of both stdout and stderr from the Ansible Playbook run
runs:
using: node12
main: main.js

13
main.js
View file

@ -86,7 +86,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)
}