---
# tasks file for perforce_sdp_monitoring
- name: "Install rsyslog packages"
become: yes
ansible.builtin.apt:
name: "rsyslog"
state: present
when: ansible_facts["os_family"] == "Debian"
- name: "Install rsyslog packages (RedHat)"
become: yes
ansible.builtin.yum:
name: "rsyslog"
state: present
when: ansible_facts["os_family"] == "RedHat"
- name: "Query Perforce server case handling"
become: yes
become_user: "{{ perforce_user }}"
ansible.builtin.shell:
cmd: "source /p4/common/bin/p4_vars {{ perforce_id }} && p4 -ztag -F %caseHandling% info"
executable: /bin/bash
register: p4_case_handling
changed_when: false
- name: Download and set permissions on p4prometheus install script.
become: yes
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/perforce/p4prometheus/master/scripts/install_p4prom.sh
dest: /p4/install_p4prom.sh
mode: '0755'
owner: "{{ perforce_user }}"
group: "{{ perforce_group }}"
retries: 3
delay: 10
register: p4prom_download
until: p4prom_download is not failed
- name: "Set case_sensitive_server to false in install script"
become: yes
ansible.builtin.replace:
path: /p4/install_p4prom.sh
regexp: 'case_sensitive_server: true'
replace: 'case_sensitive_server: false'
when: p4_case_handling.stdout == "insensitive"
- name: "Set output_cmds_by_ip to true in install script"
become: yes
ansible.builtin.replace:
path: /p4/install_p4prom.sh
regexp: 'output_cmds_by_ip: false'
replace: 'output_cmds_by_ip: true'
- name: Run the install script
become: yes
shell: "/p4/install_p4prom.sh {{ perforce_id }} -m {{ p4prometheus_metrics_dir }}"
- name: "Create p4prometheus location file"
become: yes
template:
src: "./p4prometheus_location.j2"
dest: "{{ p4prometheus_metrics_dir }}/location.prom"
owner: "{{ perforce_user }}"
group: "{{ perforce_group }}"
# --- P4 Health Check Probe ---
- name: "Install p4 health check script"
become: yes
template:
src: "./p4_healthcheck.sh.j2"
dest: "/p4/common/bin/p4_healthcheck.sh"
mode: '0755'
owner: "{{ perforce_user }}"
group: "{{ perforce_group }}"
- name: "Create p4 health check cron job"
become: yes
become_user: "{{ perforce_user }}"
ansible.builtin.cron:
name: "p4 health check"
job: "/p4/common/bin/p4_healthcheck.sh"
minute: "*"
# --- Network Latency Monitoring ---
- name: "Install network latency monitoring script"
become: yes
template:
src: "./p4_network_latency.sh.j2"
dest: "/p4/common/bin/p4_network_latency.sh"
mode: '0755'
owner: "{{ perforce_user }}"
group: "{{ perforce_group }}"
when: p4_network_latency_enabled and commit_dns is defined
- name: "Create network latency cron job"
become: yes
become_user: "{{ perforce_user }}"
ansible.builtin.cron:
name: "p4 network latency check"
job: "/p4/common/bin/p4_network_latency.sh"
minute: "*"
when: p4_network_latency_enabled and commit_dns is defined
# --- Disk Space Monitoring ---
- name: "Install disk space monitoring script"
become: yes
template:
src: "./p4_disk_space.sh.j2"
dest: "/p4/common/bin/p4_disk_space.sh"
mode: '0755'
owner: "{{ perforce_user }}"
group: "{{ perforce_group }}"
- name: "Create disk space monitoring cron job"
become: yes
become_user: "{{ perforce_user }}"
ansible.builtin.cron:
name: "p4 disk space check"
job: "/p4/common/bin/p4_disk_space.sh"
minute: "*/5"
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #5 | 32509 | Russell C. Jackson (Rusty) | Fix shell module bash executable and add retry logic for p4prometheus download | ||
| #4 | 32508 | Russell C. Jackson (Rusty) | Fix shell module to use /bin/bash for source command and update deprecated ansible_os_family to ansible_facts["os_family"] | ||
| #3 | 32507 | Russell C. Jackson (Rusty) |
Fix monitoring role bugs and add health check, network latency, and disk space monitoring. - Fix circular symlink (src and dest were identical) - Fix force_apt_get on generic package module (split by OS family) - Add missing become:yes on privileged tasks - Add perforce_location defaults to prevent undefined variable errors - Make case sensitivity check query live server via p4 info - Remove redundant tasks already handled by install_p4prom.sh - Remove unused handlers - Add p4 health check probe (p4 info liveness and response time) - Add network latency monitoring (ping commit server) - Add disk space monitoring with configurable warn/crit thresholds |
||
| #2 | 32492 | Russell C. Jackson (Rusty) |
Fix bugs, remove orphaned files, and apply best practices to ansible-sdp - Fix broken Jinja2 filter syntax (|bool|) in main-playbook.yml - Fix target_server logic comparing string literals instead of variables - Fix package install failing on RedHat due to missing OS family guard - Split packages into OS-agnostic and Debian-specific lists, remove duplicates - Switch all binary downloads from HTTP to HTTPS - Remove 7 orphaned files (unused templates, scripts, configs) - Replace hardcoded emails in cron with template variables - Fix inconsistent journal rotations (06:00/08:00) to use rotate_journal.sh - Parameterize admin sudoers and perforce user password - Fix ansible.cfg malformed vars block - Fix ansibleuser sudo group for RedHat (wheel) vs Debian (sudo) - Remove redundant triple broker start/restart in install.yml - Replace shell sed with ansible.builtin.replace in monitoring role - Fix duplicate handler and undefined variable in monitoring handlers - Use notify handlers instead of inline commands for sysctl/THP - Add idempotency (creates:) to pyenv install |
||
| #1 | 32488 | Russell C. Jackson (Rusty) | Ansible scaffolding for the sdp - Needs work. |