mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-01-11 05:51:42 -07:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4133a9690 | ||
|
|
a4d1256d3c | ||
|
|
245b181622 | ||
|
|
fda8a7386a | ||
|
|
27828f1042 | ||
|
|
241ff10e9a | ||
|
|
85f47e79c9 | ||
|
|
61ed42d89c | ||
|
|
d6db4b2224 | ||
|
|
671eb8d192 | ||
|
|
8127eb81bd | ||
|
|
ec769f0156 | ||
|
|
a8c07a7430 | ||
|
|
b22f54b51e |
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -64,7 +64,7 @@ jobs:
|
||||
PermitRootLogin no
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
EOF
|
||||
sudo systemctl restart sshd
|
||||
sudo systemctl restart ssh
|
||||
echo 'SSH_KNOWN_HOSTS<<EOF' >> $GITHUB_ENV
|
||||
echo $(ssh-keyscan localhost) >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
@@ -97,6 +97,13 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: With check mode
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
directory: test
|
||||
check_mode: true
|
||||
options: --inventory hosts
|
||||
- name: With custom ansible.cfg
|
||||
uses: ./
|
||||
with:
|
||||
|
||||
@@ -34,9 +34,15 @@ inputs:
|
||||
sudo:
|
||||
description: Set to "true" if root is required for running your playbook
|
||||
required: false
|
||||
default: false
|
||||
no_color:
|
||||
description: Set to "true" if the Ansible output should not include colors (defaults to "false")
|
||||
required: false
|
||||
default: false
|
||||
check_mode:
|
||||
description: Set to "true" to enable check (dry-run) mode
|
||||
required: false
|
||||
default: false
|
||||
outputs:
|
||||
output:
|
||||
description: The captured output of both stdout and stderr from the Ansible Playbook run
|
||||
|
||||
9
main.js
9
main.js
@@ -15,8 +15,9 @@ async function main() {
|
||||
const vaultPassword = core.getInput("vault_password")
|
||||
const knownHosts = core.getInput("known_hosts")
|
||||
const options = core.getInput("options")
|
||||
const sudo = core.getInput("sudo")
|
||||
const noColor = core.getInput("no_color")
|
||||
const sudo = core.getBooleanInput("sudo")
|
||||
const noColor = core.getBooleanInput("no_color")
|
||||
const checkMode = core.getBooleanInput("check_mode")
|
||||
const fileMode = 0600
|
||||
|
||||
let cmd = ["ansible-playbook", playbook]
|
||||
@@ -94,6 +95,10 @@ async function main() {
|
||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||
}
|
||||
|
||||
if (checkMode) {
|
||||
cmd.push("--check")
|
||||
}
|
||||
|
||||
let output = ""
|
||||
await exec.exec(cmd.join(' '), null, {
|
||||
listeners: {
|
||||
|
||||
38
package-lock.json
generated
38
package-lock.json
generated
@@ -6,18 +6,18 @@
|
||||
"": {
|
||||
"name": "action-ansible-playbook",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"yaml": "^2.3.4"
|
||||
"yaml": "^2.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz",
|
||||
"integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==",
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
||||
"integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
@@ -59,9 +59,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.28.2",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz",
|
||||
"integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==",
|
||||
"version": "5.28.5",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
@@ -69,18 +70,13 @@
|
||||
"node": ">=14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||
"integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz",
|
||||
"integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==",
|
||||
"bin": {
|
||||
"yaml": "bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name": "action-ansible-playbook",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"yaml": "^2.3.4"
|
||||
"yaml": "^2.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user