1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2025-04-18 13:53:34 +00:00

Compare commits

...

16 commits

Author SHA1 Message Date
dependabot[bot]
5966a43d57
build(deps): bump yaml from 2.7.0 to 2.7.1 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-31 11:39:46 +02:00
Dawid Dziurla
23bc8e29ed
v3 2025-02-10 18:22:57 +01:00
dependabot[bot]
a4133a9690
build(deps): bump undici from 5.28.4 to 5.28.5 ()
Bumps [undici](https://github.com/nodejs/undici) from 5.28.4 to 5.28.5.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.4...v5.28.5)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-10 18:13:52 +01:00
Alex van den Hoogen
a4d1256d3c
Add check mode and fixes boolean inputs ()
* Add check mode option

* Fixes boolean inputs

Boolean inputs weren't working properly before. Passing any value would
result in `true`, which is unexpected and not according to inputs
description. This change retrieves booleans with `getBooleanInput()` and
sets a default to `false`.

Relevant GitHub discussion and comment: https://github.com/actions/toolkit/issues/361#issuecomment-829507270

* Update action.yml

* Update test.yml

* Update test.yml

---------

Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
2025-02-10 18:11:33 +01:00
dependabot[bot]
245b181622
build(deps): bump yaml from 2.6.1 to 2.7.0 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.6.1 to 2.7.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.6.1...v2.7.0)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-31 08:55:32 +01:00
dependabot[bot]
fda8a7386a
build(deps): bump yaml from 2.6.0 to 2.6.1 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.6.0...v2.6.1)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-20 07:37:53 +01:00
dependabot[bot]
27828f1042
build(deps): bump yaml from 2.5.1 to 2.6.0 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.5.1 to 2.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.5.1...v2.6.0)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 08:29:40 +02:00
dependabot[bot]
241ff10e9a
build(deps): bump @actions/core from 1.11.0 to 1.11.1 ()
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.11.0 to 1.11.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-07 14:09:31 +02:00
dependabot[bot]
85f47e79c9
build(deps): bump @actions/core from 1.10.1 to 1.11.0 ()
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.10.1 to 1.11.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-03 08:00:38 +02:00
dependabot[bot]
61ed42d89c
build(deps): bump yaml from 2.4.3 to 2.5.1 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.4.3 to 2.5.1.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.4.3...v2.5.1)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-04 09:52:30 +02:00
dependabot[bot]
d6db4b2224
build(deps): bump yaml from 2.4.2 to 2.4.3 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.4.2...v2.4.3)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 07:45:07 +02:00
dependabot[bot]
671eb8d192
build(deps): bump yaml from 2.4.1 to 2.4.2 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.4.1...v2.4.2)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-10 00:09:29 +02:00
dependabot[bot]
8127eb81bd
build(deps): bump undici from 5.28.3 to 5.28.4 ()
Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-05 08:23:38 +02:00
dependabot[bot]
ec769f0156
build(deps): bump yaml from 2.4.0 to 2.4.1 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-07 08:27:29 +01:00
dependabot[bot]
a8c07a7430
build(deps): bump yaml from 2.3.4 to 2.4.0 ()
Bumps [yaml](https://github.com/eemeli/yaml) from 2.3.4 to 2.4.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.3.4...v2.4.0)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 09:00:20 +01:00
dependabot[bot]
b22f54b51e
build(deps): bump undici from 5.28.2 to 5.28.3 ()
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-16 22:58:51 +01:00
6 changed files with 42 additions and 27 deletions

View file

@ -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:

View file

@ -8,7 +8,7 @@ Should work on any OS, if `ansible-playbook` command is available in `PATH`.
```yaml
- name: Run playbook
uses: dawidd6/action-ansible-playbook@v2
uses: dawidd6/action-ansible-playbook@v3
with:
# Required, playbook filepath
playbook: deploy.yml

View file

@ -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

View file

@ -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: {

39
package-lock.json generated
View file

@ -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.1"
}
},
"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,14 @@
"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.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz",
"integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14"
}

View file

@ -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.1"
}
}