Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step Upgrade acme.sh: State is set to "changed" when acme.sh is already up to date #22

Open
fkonradmain opened this issue Jun 13, 2024 · 0 comments

Comments

@fkonradmain
Copy link

The optional Step Upgrade acme.sh which runs acme.sh --upgrade in the background, produces the output

[Thu Jun 13 17:31:04 CEST 2024] Already uptodate!
[Thu Jun 13 17:31:04 CEST 2024] Upgrade success!

when acme.sh already was up to date when triggering the upgrade.

Yet line 54 in tasks/main.yml only queries if "Upgrade success!" was in stdout. If said string was in stdout, it sets changed to true.

My recommendation is, adding a condition that sets changed to false when Already uptodate! is in stdout.

For example this seems to work:

  changed_when:
    - upgrade_result.rc == 0
    - "Upgrade success" in upgrade_result.stdout
    - not("Already uptodate" in upgrade_result.stdout)

Link to the mentioned code: https://github.com/nickjj/ansible-acme-sh/blob/76c835e9f7dd387d1612ff8b4d58c4aaf2d812e1/tasks/main.yml#L54C3-L54C86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant