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:
parent
7e6cacac83
commit
d8a8e9121d
2 changed files with 6 additions and 10 deletions
|
@ -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
10
main.js
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue