set_limits.yml #1

  • //
  • guest/
  • russell_jackson/
  • ansible-sdp/
  • roles/
  • perforce-sdp-install/
  • tasks/
  • group_limits/
  • set_limits.yml
  • View
  • Commits
  • Open Download .zip Download (939 B)
---
# Log the admin in, then set the Max* values on each managed group. The helper
# writes only on a real diff, so changed_when reflects an actual change. Group
# names and values come from p4_group_limits (host_vars).
- name: "Ensure the admin is logged in for group operations"
  ansible.builtin.command: "/p4/common/bin/p4login {{ perforce_id }}"
  become: true
  become_user: "{{ perforce_user }}"
  changed_when: false

- name: "Set the resource limits on each managed group"
  ansible.builtin.command: >-
    /p4/common/bin/manage_p4group.py set-limits {{ perforce_id }} {{ item.name }}
    --owner {{ perforce_admin_user }}
    {% for field, value in item.limits.items() %}--set {{ field }}={{ value }} {% endfor %}
  become: true
  become_user: "{{ perforce_user }}"
  loop: "{{ p4_group_limits }}"
  loop_control:
    label: "{{ item.name }}"
  register: set_limits_result
  changed_when: "'changed' in set_limits_result.stdout"
# Change User Description Committed
#1 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.