mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-12-09 14:20:42 -07:00
Add ability to turn off colored output (#32)
* Add Action input to control colored Ansible output * Update main.js Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
committed by
GitHub
parent
00e2fc8809
commit
671974ed60
7
main.js
7
main.js
@@ -15,6 +15,7 @@ async function main() {
|
||||
const knownHosts = core.getInput("known_hosts")
|
||||
const options = core.getInput("options")
|
||||
const sudo = core.getInput("sudo")
|
||||
const noColor = core.getInput("no_color")
|
||||
|
||||
let cmd = ["ansible-playbook", playbook]
|
||||
|
||||
@@ -79,7 +80,11 @@ async function main() {
|
||||
cmd.unshift("sudo", "-E", "env", `PATH=${process.env.PATH}`)
|
||||
}
|
||||
|
||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||
if (noColor) {
|
||||
process.env.ANSIBLE_NOCOLOR = "True"
|
||||
} else {
|
||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||
}
|
||||
|
||||
let output = ""
|
||||
await exec.exec(cmd.join(' '), null, {
|
||||
|
||||
Reference in New Issue
Block a user