1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2025-04-22 07:43:35 +00:00

Update main.js

This commit is contained in:
Dawid Dziurla 2021-07-19 17:47:04 +02:00 committed by GitHub
parent 8b926faefd
commit 2310dfcf83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

10
main.js
View file

@ -16,7 +16,6 @@ async function main() {
const options = core.getInput("options")
const sudo = core.getInput("sudo")
let cmd = ["ansible-playbook", playbook]
if (options) {
@ -66,11 +65,6 @@ async function main() {
cmd.push(vaultPasswordFile)
}
if (sudo) {
cmd.unshift("sudo")
}
if (knownHosts) {
const knownHostsFile = ".ansible_known_hosts"
fs.writeFileSync(knownHostsFile, knownHosts, { mode: 0600 })
@ -88,11 +82,13 @@ async function main() {
process.env.ANSIBLE_HOST_KEY_CHECKING = "False"
}
if (sudo) {
cmd.unshift("sudo")
}
process.env.ANSIBLE_FORCE_COLOR = "True"
await exec.exec(cmd.join(' '))
} catch (error) {
core.setFailed(error.message)
}