From 5d97973d54a3828cbd59e93f5e8681f104054c77 Mon Sep 17 00:00:00 2001 From: Skydust Date: Sun, 24 Nov 2024 21:34:31 +0100 Subject: [PATCH] Added check mode --- .gitignore | 0 action.yml | 5 +++++ entrypoint.sh | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/action.yml b/action.yml index e6eb2bb..561c1ab 100644 --- a/action.yml +++ b/action.yml @@ -7,9 +7,14 @@ inputs: path: description: The playbook's path required: true + check_only: + description: Whether to only check without changes + required: false + default: "false" runs: using: docker image: Dockerfile env: INPUT_PATH: ${{ inputs.path }} + INPUT_CHECK_ONLY: ${{ inputs.check_only }} diff --git a/entrypoint.sh b/entrypoint.sh index fb8c591..3295c3a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,11 @@ #!/usr/bin/env ash set -e -ansible-playbook "$INPUT_PATH" -vv + +if [ "$INPUT_CHECK_ONLY" = "true" ]; then + ANSIBLE_OPTIONS="--check --diff" +fi; + +ansible-playbook "$INPUT_PATH" -vv "$ANSIBLE_OPTIONS" exit 0