mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-09-05 08:25:46 -06:00
Add Action input to control colored Ansible output
This commit is contained in:
parent
fbcc2c2bae
commit
260954ef6a
@ -31,6 +31,9 @@ inputs:
|
|||||||
sudo:
|
sudo:
|
||||||
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
|
||||||
|
no_color:
|
||||||
|
description: Set to "true" if the Ansible output should not include colors (defaults to "false")
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
7
main.js
7
main.js
@ -15,6 +15,7 @@ async function main() {
|
|||||||
const knownHosts = core.getInput("known_hosts")
|
const knownHosts = core.getInput("known_hosts")
|
||||||
const options = core.getInput("options")
|
const options = core.getInput("options")
|
||||||
const sudo = core.getInput("sudo")
|
const sudo = core.getInput("sudo")
|
||||||
|
const no_color = core.getInput("no_color")
|
||||||
|
|
||||||
let cmd = ["ansible-playbook", playbook]
|
let cmd = ["ansible-playbook", playbook]
|
||||||
|
|
||||||
@ -79,7 +80,11 @@ async function main() {
|
|||||||
cmd.unshift("sudo", "-E", "env", `PATH=${process.env.PATH}`)
|
cmd.unshift("sudo", "-E", "env", `PATH=${process.env.PATH}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
if (no_color) {
|
||||||
|
process.env.ANSIBLE_NOCOLOR = "True"
|
||||||
|
} else {
|
||||||
|
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||||
|
}
|
||||||
|
|
||||||
await exec.exec(cmd.join(' '))
|
await exec.exec(cmd.join(' '))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user