mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-12-27 10:36:09 -07:00
0689c791d8
* Introduce optional support for ansible.cfg * Add missing ansible.cfg local & remote tests * Update Readme * Fix broken local test --------- Co-authored-by: thehedhly <thehedhly@users.noreply.github.com>
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
const core = require('@actions/core')
|
|
const fs = require('fs')
|
|
|
|
function rm(file) {
|
|
if (fs.existsSync(file)) {
|
|
core.info(`Deleting "${file}" file`)
|
|
fs.unlinkSync(file)
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
try {
|
|
const directory = core.getState("directory")
|
|
const ansibleConfigurationFile = core.getState("ansibleConfigurationFile")
|
|
const keyFile = core.getState("keyFile")
|
|
const inventoryFile = core.getState("inventoryFile")
|
|
const vaultPasswordFile = core.getState("vaultPasswordFile")
|
|
const knownHostsFile = core.getState("knownHostsFile")
|
|
|
|
if (directory)
|
|
process.chdir(directory)
|
|
|
|
if (ansibleConfigurationFile)
|
|
rm(ansibleConfigurationFile)
|
|
|
|
if (keyFile)
|
|
rm(keyFile)
|
|
|
|
if (inventoryFile)
|
|
rm(inventoryFile)
|
|
|
|
if (vaultPasswordFile)
|
|
rm(vaultPasswordFile)
|
|
|
|
if (knownHostsFile)
|
|
rm(knownHostsFile)
|
|
|
|
} catch (error) {
|
|
core.setFailed(error.message)
|
|
}
|
|
}
|
|
|
|
main()
|