@ -26,34 +26,34 @@
|
|||||||
- name: check Cache Files
|
- name: check Cache Files
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ cache_filepath }}"
|
path: "{{ cache_filepath }}"
|
||||||
register: cache_files
|
register: cached_file
|
||||||
|
|
||||||
|
|
||||||
- name: Expire
|
- name: Expire
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
expired: "{{ ((epoch | int + (nfc_c_epoch_time_offset | default(0)) | int) >= ((cache_files.stat.mtime | int) + nfc_c_cache_expire_time | int) | int ) | bool }}"
|
expired: "{{ ((epoch | int + (nfc_c_epoch_time_offset | default(0)) | int) >= ((cached_file.stat.mtime | int) + nfc_c_cache_expire_time | int) | int ) | bool }}"
|
||||||
when: cache_files.stat.exists
|
when: cached_file.stat.exists
|
||||||
|
|
||||||
|
|
||||||
- name: TRACE - Cached file
|
- name: TRACE - Cached file
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg:
|
msg:
|
||||||
- "exists: {{ cache_files.stat.exists | default('') }}"
|
- "exists: {{ cached_file.stat.exists | default('') }}"
|
||||||
- "mtime: {{ cache_files.stat.mtime | default(0) | int }}"
|
- "mtime: {{ cached_file.stat.mtime | default(0) | int }}"
|
||||||
- "expire: {{ (cache_files.stat.mtime | int) + nfc_c_cache_expire_time | int }}"
|
- "expire: {{ (cached_file.stat.mtime | int) + nfc_c_cache_expire_time | int }}"
|
||||||
- "epoch: {{ (epoch | int + (nfc_c_epoch_time_offset | default(0)) | int) | int }} [{{ nfc_c_cache_expire_time }}]"
|
- "epoch: {{ (epoch | int + (nfc_c_epoch_time_offset | default(0)) | int) | int }} [{{ nfc_c_cache_expire_time }}]"
|
||||||
- "epoch: {{ epoch }}"
|
- "epoch: {{ epoch }}"
|
||||||
- "expired: {{ expired }}"
|
- "expired: {{ expired }}"
|
||||||
when: cache_files.stat.exists
|
when: cached_file.stat.exists
|
||||||
|
|
||||||
- name: Expire Cache
|
- name: Expire Cache
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ cache_files.stat.path }}"
|
path: "{{ cached_file.stat.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
when: >
|
when: >
|
||||||
expired
|
expired
|
||||||
and
|
and
|
||||||
cache_files.stat.exists
|
cached_file.stat.exists
|
||||||
|
|
||||||
|
|
||||||
- name: >
|
- name: >
|
||||||
@ -80,10 +80,10 @@
|
|||||||
(
|
(
|
||||||
expired
|
expired
|
||||||
and
|
and
|
||||||
cache_files.stat.exists
|
cached_file.stat.exists
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
not cache_files.stat.exists
|
not cached_file.stat.exists
|
||||||
|
|
||||||
|
|
||||||
- name: Create Cache DIR
|
- name: Create Cache DIR
|
||||||
@ -104,9 +104,9 @@
|
|||||||
(
|
(
|
||||||
expired
|
expired
|
||||||
and
|
and
|
||||||
cache_files.stat.exists
|
cached_file.stat.exists
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
not cache_files.stat.exists
|
not cached_file.stat.exists
|
||||||
and
|
and
|
||||||
api_call.status | default(0) | int != 404
|
api_call.status | default(0) | int != 404
|
||||||
|
Reference in New Issue
Block a user