mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-10 03:01:29 -07:00
Update get_certificate.py (#56594)
* Update get_certificate.py with an example to calculate number of days until cert expires from get_certificate result. * Update lib/ansible/modules/crypto/get_certificate.py Co-Authored-By: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
53ec9c8019
commit
cb9be4ddaf
1 changed files with 6 additions and 0 deletions
|
@ -107,6 +107,12 @@ EXAMPLES = '''
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
run_once: true
|
run_once: true
|
||||||
register: cert
|
register: cert
|
||||||
|
|
||||||
|
- name: How many days until cert expires
|
||||||
|
debug:
|
||||||
|
msg: "cert expires in: {{ expire_days }} days."
|
||||||
|
vars:
|
||||||
|
expire_days: "{{ (( cert.not_after | to_datetime('%Y%m%d%H%M%SZ')) - (ansible_date_time.iso8601 | to_datetime('%Y-%m-%dT%H:%M:%SZ')) ).days }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue