--- # 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