---
# Verify: assert the install produced a running, configured commit-server, then
# run the full SDP functional test harness.
- name: Verify
hosts: all
become: true
tasks:
- name: "Confirm the perforce OS user exists"
ansible.builtin.command: "id {{ perforce_user }}"
changed_when: false
- name: "SDP environment is in place"
ansible.builtin.stat:
path: "/p4/common/bin/p4_vars"
register: p4vars
- name: "Assert p4_vars is present"
ansible.builtin.assert:
that: p4vars.stat.exists
fail_msg: "/p4/common/bin/p4_vars missing -- SDP layout did not install"
- name: "Confirm the p4d systemd service is active" # noqa: command-instead-of-module
ansible.builtin.command: "systemctl is-active p4d_{{ perforce_id }}"
register: p4d_active
changed_when: false
failed_when: p4d_active.stdout != "active"
- name: "Check p4 info responds (run as the perforce user)"
become: true
become_user: "{{ perforce_user }}"
ansible.builtin.shell:
cmd: "source /p4/common/bin/p4_vars {{ perforce_id }} && p4 info"
executable: /bin/bash
register: p4info
changed_when: false
- name: "Assert the server is the configured commit-server (ServerID master)"
ansible.builtin.assert:
that: "'ServerID: master' in p4info.stdout"
fail_msg: "p4 info did not report 'ServerID: master'; server not configured. Output:\n{{ p4info.stdout }}"
# --- Group resource guardrails ---
- name: "Confirm the guardrail scripts are deployed"
ansible.builtin.stat:
path: "/p4/common/bin/{{ item }}"
loop:
- "triggers/keep_group_unset.py"
- "update_limits.py"
- "manage_p4group.py"
register: guardrail_scripts
- name: "Assert the guardrail scripts exist"
ansible.builtin.assert:
that: item.stat.exists
fail_msg: "missing guardrail script: {{ item.item }}"
loop: "{{ guardrail_scripts.results }}"
loop_control:
label: "{{ item.item }}"
- name: "Read the limits and p4-unlimited group specs"
become: true
become_user: "{{ perforce_user }}"
ansible.builtin.shell:
cmd: "source /p4/common/bin/p4_vars {{ perforce_id }} && p4 group -o {{ item }}"
executable: /bin/bash
loop:
- limits
- p4-unlimited
register: guardrail_groups
changed_when: false
- name: "Assert the baseline limits group carries the configured Max* value"
ansible.builtin.assert:
that: "'500000' in guardrail_groups.results[0].stdout"
fail_msg: "limits group missing baseline MaxResults=500000. Spec:\n{{ guardrail_groups.results[0].stdout }}"
- name: "Assert the p4-unlimited group is unlimited"
ansible.builtin.assert:
that: "'unlimited' in guardrail_groups.results[1].stdout"
fail_msg: "p4-unlimited group is not unlimited. Spec:\n{{ guardrail_groups.results[1].stdout }}"
- name: "Run the SDP functional test harness (full integration)"
ansible.builtin.import_role:
name: perforce-sdp-install
tasks_from: test
vars:
run_sdp_tests: true
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 32894 | Russell C. Jackson (Rusty) |
Add group resource guardrails to perforce-sdp-install; inventory cleanup Guardrails (gated on guardrails_enabled, commit server): - New group_limits phase (thin orchestrator + group_limits/ subdir: deploy_scripts, set_limits, populate) included from main.yml. Templates the SDP keep_group_unset.py trigger and update_limits.py from inventory so no group/user name is hardcoded; sets Max* on each managed group via the new idempotent files/manage_p4group.py helper; populates the limits group once (marker-guarded). No new cron -- the SDP's hourly master cron maintains membership. - Every group name is its own variable (p4_baseline_group, p4_integrators_group, p4_unlimited_group, p4_admins_group, p4_replicas_group); p4_group_limits is a list of {name, limits}. Naming convention in group_vars/main; per-environment values + enable flag in each commit server's host_vars; safe fallbacks in defaults. - Molecule: install scenario now runs the guardrails phase after configure_new_server and verifies the scripts are deployed and the limits/p4-unlimited groups carry the expected values. README + docs updated. Inventory cleanup: - Removed the 2kgla1tst2 and la1v-rjackson commit hosts (host_vars + inventory). - Renamed the top-level inventory group central -> main (group_vars dir moved, references updated across inventory, molecule, README, CLAUDE.md). ansible-lint production-clean; playbooks syntax-check; helper/templates compile. |
||
| #1 | 32873 | Russell C. Jackson (Rusty) |
Add full-integration Molecule scenarios for both ansible roles roles/{perforce-sdp-install,perforce-sdp-monitoring}/molecule/default/ each with molecule.yml + prepare.yml + converge.yml + verify.yml. Uses the docker driver with geerlingguy systemd images on Ubuntu 22.04 and Rocky 9 (Debian + RedHat/EL). - install: prepare creates SDP volume dirs; converge runs the role (fresh SDP install -> p4d up) then configure_new_server.sh; verify asserts the service is active, p4 info reports ServerID master, and runs the SDP functional test harness (run_sdp_tests). - monitoring: prepare brings up + configures p4d via the install role; converge applies the monitoring role; verify checks the probe scripts/cron are deployed and runs p4_healthcheck.sh, asserting p4_up=1 against the live server. Idempotence step omitted (a full p4d install is not idempotent). README documents prerequisites and usage. Validated with ansible-playbook --syntax-check and ansible-lint (production profile clean for both the scenarios and the whole project). |