mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-09-05 00:15:47 -06:00
Revert "Rename cmd to args"
This reverts commit 98591e551340181dbc3f5e6943d53ad453bc3832.
This commit is contained in:
parent
acb5e94696
commit
e8ab09a21f
22
main.js
22
main.js
@ -16,10 +16,10 @@ async function main() {
|
|||||||
const options = core.getInput("options")
|
const options = core.getInput("options")
|
||||||
const sudo = core.getInput("sudo")
|
const sudo = core.getInput("sudo")
|
||||||
|
|
||||||
let args = [playbook]
|
let cmd = [playbook]
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
args.push(options.replace(/\n/g, " "))
|
cmd.push(options.replace(/\n/g, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directory) {
|
if (directory) {
|
||||||
@ -45,38 +45,38 @@ async function main() {
|
|||||||
const keyFile = ".ansible_key"
|
const keyFile = ".ansible_key"
|
||||||
fs.writeFileSync(keyFile, key + os.EOL, { mode: 0600 })
|
fs.writeFileSync(keyFile, key + os.EOL, { mode: 0600 })
|
||||||
core.saveState("keyFile", keyFile)
|
core.saveState("keyFile", keyFile)
|
||||||
args.push("--key-file")
|
cmd.push("--key-file")
|
||||||
args.push(keyFile)
|
cmd.push(keyFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory) {
|
if (inventory) {
|
||||||
const inventoryFile = ".ansible_inventory"
|
const inventoryFile = ".ansible_inventory"
|
||||||
fs.writeFileSync(inventoryFile, inventory, { mode: 0600 })
|
fs.writeFileSync(inventoryFile, inventory, { mode: 0600 })
|
||||||
core.saveState("inventoryFile", inventoryFile)
|
core.saveState("inventoryFile", inventoryFile)
|
||||||
args.push("--inventory-file")
|
cmd.push("--inventory-file")
|
||||||
args.push(inventoryFile)
|
cmd.push(inventoryFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vaultPassword) {
|
if (vaultPassword) {
|
||||||
const vaultPasswordFile = ".ansible_vault_password"
|
const vaultPasswordFile = ".ansible_vault_password"
|
||||||
fs.writeFileSync(vaultPasswordFile, vaultPassword, { mode: 0600 })
|
fs.writeFileSync(vaultPasswordFile, vaultPassword, { mode: 0600 })
|
||||||
core.saveState("vaultPasswordFile", vaultPasswordFile)
|
core.saveState("vaultPasswordFile", vaultPasswordFile)
|
||||||
args.push("--vault-password-file")
|
cmd.push("--vault-password-file")
|
||||||
args.push(vaultPasswordFile)
|
cmd.push(vaultPasswordFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (knownHosts) {
|
if (knownHosts) {
|
||||||
const knownHostsFile = ".ansible_known_hosts"
|
const knownHostsFile = ".ansible_known_hosts"
|
||||||
fs.writeFileSync(knownHostsFile, knownHosts, { mode: 0600 })
|
fs.writeFileSync(knownHostsFile, knownHosts, { mode: 0600 })
|
||||||
core.saveState("knownHostsFile", knownHostsFile)
|
core.saveState("knownHostsFile", knownHostsFile)
|
||||||
args.push(`--ssh-common-args="-o UserKnownHostsFile=${knownHostsFile}"`)
|
cmd.push(`--ssh-common-args="-o UserKnownHostsFile=${knownHostsFile}"`)
|
||||||
process.env.ANSIBLE_HOST_KEY_CHECKING = "True"
|
process.env.ANSIBLE_HOST_KEY_CHECKING = "True"
|
||||||
} else {
|
} else {
|
||||||
process.env.ANSIBLE_HOST_KEY_CHECKING = "False"
|
process.env.ANSIBLE_HOST_KEY_CHECKING = "False"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sudo) {
|
if (sudo) {
|
||||||
args.unshift("sudo", "-E", "env", `PATH=${process.env.PATH}`)
|
cmd.unshift("sudo", "-E", "env", `PATH=${process.env.PATH}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||||
@ -91,7 +91,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await exec.exec("ansible-playbook", args, execOptions)
|
await exec.exec("ansible-playbook", cmd, execOptions)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user