---
# OS package management: refresh metadata, upgrade, enable EPEL on RedHat, then
# install the common and family-specific package sets.
- name: "Update apt package cache"
ansible.builtin.apt:
update_cache: true
# Skip the refresh (and the spurious "changed") when the cache is recent.
cache_valid_time: 3600
when: ansible_facts["os_family"] == "Debian"
- name: "Upgrade all packages to the latest version (Debian)"
ansible.builtin.apt:
upgrade: dist
when: ansible_facts["os_family"] == "Debian"
- name: "Upgrade all packages to the latest version (RedHat)"
ansible.builtin.dnf:
name: "*"
state: latest
# EL9 ships curl-minimal; allow replacing it so the full curl can be installed.
allowerasing: true
nobest: true
when: ansible_facts["os_family"] == "RedHat"
- name: "Enable EPEL repository (provides libuser, python3-virtualenv, rdiff-backup)"
ansible.builtin.dnf:
name: "{{ epel_release_rpm }}"
state: present
disable_gpg_check: "{{ epel_disable_gpg_check }}"
when: ansible_facts["os_family"] == "RedHat"
- name: "Install common packages (RedHat)"
ansible.builtin.dnf:
name: "{{ list_of_packages }}"
state: latest
# allowerasing: curl replaces EL9's curl-minimal. skip_broken: tolerate EPEL
# packages with unmet deps on some arches (e.g. python3-virtualenv on aarch64).
allowerasing: true
nobest: true
skip_broken: true
when: ansible_facts["os_family"] == "RedHat"
- name: "Install common packages (non-RedHat)"
ansible.builtin.package:
name: "{{ list_of_packages }}"
state: latest
when: ansible_facts["os_family"] != "RedHat"
- name: "Remove packages"
ansible.builtin.package:
name: "{{ list_of_packages_to_remove }}"
state: absent
- name: "Install RedHat packages"
ansible.builtin.dnf:
name: "{{ list_of_redhat_packages }}"
state: latest
allowerasing: true
nobest: true
skip_broken: true
when: ansible_facts["os_family"] == "RedHat"
- name: "Install Debian packages"
ansible.builtin.apt:
name: "{{ list_of_debian_packages }}"
force_apt_get: true
state: latest
when: ansible_facts["os_family"] == "Debian"
- name: "Link python3 to python since Ubuntu 22.04 doesn't create python"
ansible.builtin.file:
src: /usr/bin/python3
dest: /usr/bin/python
state: link
failed_when: false
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #3 | 32879 | Russell C. Jackson (Rusty) | Harness: tolerate optional/absent scripts + accept ccheck PASS (Grade A or B) | ||
| #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 | 32842 | Russell C. Jackson (Rusty) |
Reorganize ansible-sdp into per-concern task files; ansible-lint production-clean - Split install.yml/cron.yml/dependencies.yml and the monitoring role into thin orchestrators plus single-purpose phase files; extract shared steps into tasks/common/ (fetch_sdp, fetch_binaries, run_mkdirs, copy_ssl, configure_broker, sudoers). - Full best-practices pass: FQCN, true/false, quoted modes, changed_when, loops, document-start markers; fill both roles' meta; add .ansible-lint. - RedHat parity: parameterized EPEL enable, dnf, full upgrade, sysctl/bbr tuning. - Collapse the 12 journal-rotation cron tasks to one; consolidate duplicate download/broker logic; fix broken tests/test.yml role reference. - Validated ansible-lint clean at the production profile (ansible-core 2.21 / python 3.12) and ansible-playbook --syntax-check OK. |