---
# Converge: run the install role (full fresh SDP install -> p4d up), then
# configure the new commit-server so it is ready for the functional harness.
- name: Converge
hosts: all
become: true
roles:
- role: perforce-sdp-install
post_tasks:
# The install role brings p4d up but does not configure the server (super
# user, server.id=master, depots, protections, configurables). The SDP test
# harness needs a configured, logged-in commit-server, so run it here. Gate
# it on a marker so the molecule idempotence run does not re-run it.
- name: "Configure the new commit-server (once)"
become: true
become_user: "{{ perforce_user }}"
ansible.builtin.shell: >-
/p4/sdp/Server/Unix/setup/configure_new_server.sh {{ perforce_id }}
&& touch /p4/.molecule_configured
args:
chdir: "/p4/sdp/Server/Unix/setup"
creates: "/p4/.molecule_configured"
register: configure_result
- name: "Show configure_new_server.sh output"
ansible.builtin.debug:
var: configure_result.stdout_lines
when: not (configure_result.skipped | default(false))
# Exercise the group resource guardrails against the now-configured server
# (the role gates this phase on guardrails_enabled; the server is only
# configured here in post_tasks, so run the phase directly). Idempotent, so
# the molecule idempotence step re-runs it cleanly.
- name: "Configure group resource guardrails"
ansible.builtin.import_role:
name: perforce-sdp-install
tasks_from: group_limits
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #3 | 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. |
||
| #2 | 32876 | Russell C. Jackson (Rusty) |
Make both ansible roles idempotent (full converge re-runs cleanly) Existence gate: - main.yml: stat /p4/common/bin/p4_vars -> sdp_installed fact; gate the destructive cleanup (wipe sdp folder + crontab) on 'not sdp_installed' so a re-converge skips wipe/reinstall and only reconciles idempotent config. Run-once installers gated with creates/checks: - run_mkdirs.sh: creates /p4/common/bin/p4_vars (drop changed_when:true). - pyenv: drop changed_when on the creates-guarded bootstrap; add creates for the Python build; gate p4python install on 'pip3 show p4python'. - monitoring prometheus.yml: gate the p4prometheus install script on creates /usr/local/bin/p4prometheus. changed_when:true lies fixed: - login.yml: gate admin/service logins on 'p4 login -s' (only log in when no valid ticket); use command for the no-shell status check. - network_interface.yml: ifup gated on the interface not already being UP. touch/cron idempotence: - authorized_keys touch: modification_time/access_time preserve. - cron/common.yml: remove 'crontab -r' (cron/cronvar modules manage entries idempotently by name; cron.yml is now the authoritative crontab manager). - install/crontab.yml removed + its include dropped: the SDP-generated p4.crontab load was redundant (cron.yml's reset discarded it every run). - packages.yml: apt update_cache cache_valid_time=3600. Molecule: configure_new_server gated behind a marker in the install converge and monitoring prepare; re-added the 'idempotence' step to both scenarios' test_sequence. ansible-lint production-clean; all playbooks syntax-check. |
||
| #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). |