generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
2,298 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
[remote] | ||
host ansible_user=user | ||
|
||
[local] | ||
localhost ansible_user=root ansible_connection=local | ||
localhost ansible_connection=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const core = require('@actions/core') | ||
const exec = require('@actions/exec') | ||
const fs = require('fs') | ||
const os = require('os') | ||
const path = require('path') | ||
|
||
async function main() { | ||
try { | ||
const playbook = core.getInput("playbook", { required: true }) | ||
const directory = core.getInput("directory") | ||
const key = core.getInput("key") | ||
const inventory = core.getInput("inventory") | ||
const vaultPassword = core.getInput("vault_password") | ||
const options = core.getInput("options") | ||
|
||
let cmd = ["ansible-playbook", playbook] | ||
|
||
if (options) { | ||
cmd.push(options.replace("\n", " ")) | ||
} | ||
|
||
if (directory) { | ||
process.chdir(directory) | ||
} | ||
|
||
if (key) { | ||
const keyFile = ".ansible_key" | ||
fs.writeFileSync(keyFile, key + os.EOL, { mode: 0600 }) | ||
cmd.push("--key-file") | ||
cmd.push(keyFile) | ||
} | ||
|
||
if (inventory) { | ||
const inventoryFile = ".ansible_inventory" | ||
fs.writeFileSync(inventoryFile, inventory, { mode: 0600 }) | ||
cmd.push("--inventory-file") | ||
cmd.push(inventoryFile) | ||
} | ||
|
||
if (vaultPassword) { | ||
const vaultPasswordFile = ".ansible_vault_password" | ||
fs.writeFileSync(vaultPasswordFile, vaultPassword, { mode: 0600 }) | ||
cmd.push("--vault-password-file") | ||
cmd.push(vaultPasswordFile) | ||
} | ||
|
||
process.env.ANSIBLE_HOST_KEY_CHECKING = "False" | ||
process.env.ANSIBLE_FORCE_COLOR = "True" | ||
|
||
await exec.exec(cmd.join(" ")) | ||
} catch (error) { | ||
core.setFailed(error.message) | ||
} | ||
} | ||
|
||
main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.