File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ inputs:
28
28
options :
29
29
description : Extra options that should be passed to ansible-playbook command
30
30
required : false
31
+ sudo :
32
+ description : Set to "true" if root is required for running your playbook
33
+ required : false
31
34
runs :
32
35
using : node12
33
36
main : main.js
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ async function main() {
14
14
const vaultPassword = core . getInput ( "vault_password" )
15
15
const knownHosts = core . getInput ( "known_hosts" )
16
16
const options = core . getInput ( "options" )
17
+ const sudo = core . getInput ( "sudo" )
17
18
18
19
let cmd = [ "ansible-playbook" , playbook ]
19
20
@@ -81,10 +82,13 @@ async function main() {
81
82
process . env . ANSIBLE_HOST_KEY_CHECKING = "False"
82
83
}
83
84
85
+ if ( sudo ) {
86
+ cmd . unshift ( "sudo" )
87
+ }
88
+
84
89
process . env . ANSIBLE_FORCE_COLOR = "True"
85
90
86
91
await exec . exec ( cmd . join ( ' ' ) )
87
-
88
92
} catch ( error ) {
89
93
core . setFailed ( error . message )
90
94
}
You can’t perform that action at this time.
0 commit comments