Skip to content

Commit

Permalink
fix(step_acme_cert): remove community.cryto dep (#59)
Browse files Browse the repository at this point in the history
This commit removes the dependency on community.crypto
(and by extension, the cryptography python package).
It turns out that step-cli has all the required functionality built-in,
so we use that instead
  • Loading branch information
maxhoesel authored May 7, 2021
1 parent baf9d04 commit 0802b09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ tags: ["smallstep", "ca", "certificates"]
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies:
"community.crypto": ">=1.0,<2.0"
dependencies: {}

# The URL of the originating SCM repository
repository: https://github.com/maxhoesel/ansible-collection-smallstep
Expand Down
13 changes: 6 additions & 7 deletions roles/step_acme_cert/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
path: "{{ step_acme_cert_certfile.path }}"
register: step_acme_cert_current_cert

- name: Check if certificate is expired
community.crypto.x509_certificate_info:
path: "{{ step_acme_cert_certfile.path }}"
valid_at:
now: "+0s"
register: step_acme_cert_certinfo
- name: Check if certificate is valid
changed_when: no
command: "step-cli certificate verify {{ step_acme_cert_certfile.path }}"
ignore_errors: true
register: _step_acme_cert_validity
when: step_acme_cert_current_cert.stat.exists

- include: get_cert.yml
when: not step_acme_cert_current_cert.stat.exists or not step_acme_cert_certinfo.valid_at.now
when: 'not step_acme_cert_current_cert.stat.exists or "failed to verify certificate" in _step_acme_cert_validity.stderr'

- include: renewal.yml

0 comments on commit 0802b09

Please sign in to comment.