mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2025-04-21 15:23:34 +00:00
Add sudo option for root access
This commit is contained in:
parent
3c534b3ba0
commit
afb0d3d207
2 changed files with 9 additions and 0 deletions
|
@ -25,6 +25,9 @@ inputs:
|
|||
options:
|
||||
description: Extra options that should be passed to ansible-playbook command
|
||||
required: false
|
||||
sudo:
|
||||
description: Set to "true" if root permission are required for your action
|
||||
required: false
|
||||
runs:
|
||||
using: node12
|
||||
main: main.js
|
||||
|
|
6
main.js
6
main.js
|
@ -13,6 +13,8 @@ async function main() {
|
|||
const inventory = core.getInput("inventory")
|
||||
const vaultPassword = core.getInput("vault_password")
|
||||
const options = core.getInput("options")
|
||||
const sudo = core.getInput("sudo")
|
||||
|
||||
|
||||
let cmd = ["ansible-playbook", playbook]
|
||||
|
||||
|
@ -63,6 +65,10 @@ async function main() {
|
|||
cmd.push(vaultPasswordFile)
|
||||
}
|
||||
|
||||
if (sudo) {
|
||||
cmd.unshift("sudo")
|
||||
}
|
||||
|
||||
process.env.ANSIBLE_HOST_KEY_CHECKING = "False"
|
||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue