main: support installing requirements

This commit is contained in:
Dawid Dziurla 2020-12-06 17:06:02 +01:00
parent 563b73df2f
commit 1b9385ee45
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

View File

@ -6,6 +6,7 @@ const os = require('os')
async function main() {
try {
const playbook = core.getInput("playbook", { required: true })
const requirements = core.getInput("requirements")
const directory = core.getInput("directory")
const key = core.getInput("key")
const inventory = core.getInput("inventory")
@ -23,6 +24,10 @@ async function main() {
core.saveState("directory", directory)
}
if (requirements) {
await exec.exec("ansible-galaxy", ["install", "-r", requirements])
}
if (key) {
const keyFile = ".ansible_key"
fs.writeFileSync(keyFile, key + os.EOL, { mode: 0600 })