mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2024-11-22 07:26:25 +00:00
d45b74f42d
By default it seems that SSH host key checking has been disabled. This patch makes it optional. If a variable named known_hosts is passed in, the key checking will be enabled. The variable should contain the complete contents of the known_hosts file, which must contain the public key(s) of the host(s) in the inventory.
39 lines
898 B
JavaScript
39 lines
898 B
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 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 (keyFile)
|
|
rm(keyFile)
|
|
|
|
if (inventoryFile)
|
|
rm(inventoryFile)
|
|
|
|
if (vaultPasswordFile)
|
|
rm(vaultPasswordFile)
|
|
|
|
if (knownHostsFile)
|
|
rm(knownHostsFile)
|
|
|
|
} catch (error) {
|
|
core.setFailed(error.message)
|
|
}
|
|
}
|
|
|
|
main()
|