Change 32876

russell_jackson (Russell C. Jackson (Rusty))
Russell C. Jackson (Rusty) committed this change into //guest/russell_jackson/ansible-sdp/roles
Request Review
Download .zip
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.
  • Files 14
  • Comments 0
13 edited 0 added 1 deleted
perforce-sdp-install/molecule/default/converge.yml#2
Loading...
perforce-sdp-install/molecule/default/molecule.yml#2
Loading...
perforce-sdp-install/tasks/common/run_mkdirs.yml#2
Loading...
perforce-sdp-install/tasks/cron/common.yml#2
Loading...
perforce-sdp-install/tasks/dependencies/network_interface.yml#2
Loading...
perforce-sdp-install/tasks/dependencies/packages.yml#2
Loading...
perforce-sdp-install/tasks/dependencies/pyenv.yml#2
Loading...
perforce-sdp-install/tasks/install.yml#6
Loading...
perforce-sdp-install/tasks/install/crontab.yml#2
Loading...
perforce-sdp-install/tasks/install/login.yml#2
Loading...
perforce-sdp-install/tasks/main.yml#6
Loading...
perforce-sdp-monitoring/molecule/default/molecule.yml#2
Loading...
perforce-sdp-monitoring/molecule/default/prepare.yml#2
Loading...
perforce-sdp-monitoring/tasks/prometheus.yml#3
Loading...
Tip: Use n and p to cycle through the changes.