diff --git a/files/ansible-playbooks/connstats-deploy.yml b/files/ansible-playbooks/connstats-deploy.yml index 793cb59..0626265 100644 --- a/files/ansible-playbooks/connstats-deploy.yml +++ b/files/ansible-playbooks/connstats-deploy.yml @@ -23,6 +23,7 @@ - block: + # --- SSH reachability check --- - name: Check SSH connectivity (raw ping) raw: "echo ping" register: ping_result @@ -30,7 +31,8 @@ - block: - # Step 2 fork + ############ step 2 + - name: Compute MD5 of local connstats.sh delegate_to: localhost command: md5sum files/connstats.sh @@ -67,7 +69,8 @@ raw: | 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) raw: | if [ ! -f /etc/crontabs/root ]; then @@ -78,7 +81,7 @@ - name: Check if connstats cron line already present 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 failed_when: false changed_when: false @@ -121,7 +124,7 @@ set_fact: 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 delegate_to: localhost uri: @@ -146,7 +149,7 @@ register: rmq_cf changed_when: false - # Final wrap-up journal connstats + # final wrap-up journal "connstats: ..." with actions performed - name: Build actions list set_fact: _actions_list: >- @@ -191,6 +194,7 @@ register: rmq_wrap changed_when: (rmq_wrap.json is defined) and (rmq_wrap.json.routed | default(false) | bool) + # Local summary (kept for operator visibility) - name: Summary debug: msg: