This commit is contained in:
2026-02-06 10:44:33 +02:00
parent bd1d536bf9
commit 2e6fefb2e0

View File

@@ -23,6 +23,7 @@
- block: - block:
# --- SSH reachability check ---
- name: Check SSH connectivity (raw ping) - name: Check SSH connectivity (raw ping)
raw: "echo ping" raw: "echo ping"
register: ping_result register: ping_result
@@ -30,7 +31,8 @@
- block: - block:
# Step 2 fork ############ step 2
- name: Compute MD5 of local connstats.sh - name: Compute MD5 of local connstats.sh
delegate_to: localhost delegate_to: localhost
command: md5sum files/connstats.sh command: md5sum files/connstats.sh
@@ -67,7 +69,8 @@
raw: | raw: |
chown root:root /root/connstats.sh && chmod 0755 /root/connstats.sh chown root:root /root/connstats.sh && chmod 0755 /root/connstats.sh
# Step 3 fork (cron entry only, preserve anything else) ############ step 3
- name: Ensure /etc/crontabs/root exists (touch with perms) - name: Ensure /etc/crontabs/root exists (touch with perms)
raw: | raw: |
if [ ! -f /etc/crontabs/root ]; then if [ ! -f /etc/crontabs/root ]; then
@@ -78,7 +81,7 @@
- name: Check if connstats cron line already present - name: Check if connstats cron line already present
raw: | raw: |
grep -Fxq '{{ connstats_cron_line }}' /etc/crontabs/root grep -Eq '^\*/10[[:space:]]+\*[[:space:]]+\*[[:space:]]+\*[[:space:]]+\*[[:space:]]+/root/connstats\.sh[[:space:]]+--debug[[:space:]]+--always-find-offset([[:space:]]+>/dev/null[[:space:]]+2>&1)?[[:space:]]*$' /etc/crontabs/root
register: cron_grep register: cron_grep
failed_when: false failed_when: false
changed_when: false changed_when: false
@@ -121,7 +124,7 @@
set_fact: set_fact:
inscope_device_name: "{{ ansible_hostname | default(inventory_hostname) }}" inscope_device_name: "{{ ansible_hostname | default(inventory_hostname) }}"
# Custom field update (per your sample) # custom field update (per your sample)
- name: Publish custom-field update connstats deployed to control queue - name: Publish custom-field update connstats deployed to control queue
delegate_to: localhost delegate_to: localhost
uri: uri:
@@ -146,7 +149,7 @@
register: rmq_cf register: rmq_cf
changed_when: false changed_when: false
# Final wrap-up journal connstats # final wrap-up journal "connstats: ..." with actions performed
- name: Build actions list - name: Build actions list
set_fact: set_fact:
_actions_list: >- _actions_list: >-
@@ -191,6 +194,7 @@
register: rmq_wrap register: rmq_wrap
changed_when: (rmq_wrap.json is defined) and (rmq_wrap.json.routed | default(false) | bool) changed_when: (rmq_wrap.json is defined) and (rmq_wrap.json.routed | default(false) | bool)
# Local summary (kept for operator visibility)
- name: Summary - name: Summary
debug: debug:
msg: msg: