mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-09-05 00:15:47 -06:00
Consolidate stdout and stderr into single output
This commit is contained in:
parent
7e6cacac83
commit
d8a8e9121d
@ -32,10 +32,8 @@ inputs:
|
|||||||
description: Set to "true" if root is required for running your playbook
|
description: Set to "true" if root is required for running your playbook
|
||||||
required: false
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
stdout:
|
output:
|
||||||
description: The captured output of stdout from the Ansible Playbook run
|
description: The captured output of both stdout and stderr from the Ansible Playbook run
|
||||||
stderr:
|
|
||||||
description: The captured output of stderr from the Ansible Playbook run
|
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
10
main.js
10
main.js
@ -81,21 +81,19 @@ async function main() {
|
|||||||
|
|
||||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||||
|
|
||||||
let stdout = ''
|
let output = ''
|
||||||
let stderr = ''
|
|
||||||
const execOptions = {}
|
const execOptions = {}
|
||||||
execOptions.listeners = {
|
execOptions.listeners = {
|
||||||
stdout: function(data) {
|
stdout: function(data) {
|
||||||
stdout += data.toString()
|
output += data.toString()
|
||||||
},
|
},
|
||||||
stderr: function(data) {
|
stderr: function(data) {
|
||||||
stderr += data.toString()
|
output += data.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await exec.exec("ansible-playbook", cmd, execOptions)
|
await exec.exec("ansible-playbook", cmd, execOptions)
|
||||||
core.setOutput('stdout', stdout)
|
core.setOutput('output', output)
|
||||||
core.setOutput('stderr', stderr)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user