diff --git a/playbooks/tasks/api_call.yaml b/playbooks/tasks/api_call.yaml index 870f58e..7039e2a 100644 --- a/playbooks/tasks/api_call.yaml +++ b/playbooks/tasks/api_call.yaml @@ -43,6 +43,7 @@ - "epoch: {{ (epoch | int + nfc_c_epoch_time_offset | int) | int }} [{{ nfc_c_cache_expire_time }}]" - "epoch: {{ epoch }}" - "expired: {{ expired }}" + when: cache_files.stat.exists - name: Expire Cache ansible.builtin.file: @@ -69,8 +70,9 @@ return_content: true status_code: - 200 + - 404 validate_certs: false - changed_when: "{{ api_call.json | length | int > 0 }}" + changed_when: api_call.json | length | int > 0 no_log: true register: api_call when: > @@ -89,6 +91,8 @@ state: directory when: > '/' in api_path + and + api_call.status | default(0) | int != 404 - name: Cache Data @@ -103,3 +107,5 @@ ) or not cache_files.stat.exists + and + api_call.status | default(0) | int != 404 diff --git a/playbooks/tasks/scan_subnet.yaml b/playbooks/tasks/scan_subnet.yaml index a2fc1d3..b9df83d 100644 --- a/playbooks/tasks/scan_subnet.yaml +++ b/playbooks/tasks/scan_subnet.yaml @@ -19,6 +19,9 @@ ansible.builtin.set_fact: cached_subnet: "{{ lookup('file', cache_filepath) }}" cacheable: false + no_log: true + when: > + api_call.status | default(0) | int != 404 - name: Process Scan Results