agru replaces an installed role whenever its version differs from the
pinned one, and also when the role has no install information. It
replaces a symlinked role with a fresh copy. ansible-galaxy was run on
an emptied roles/galaxy every time. Roles being worked on in
roles/galaxy could thus silently lose their changes.
bin/install-roles.py (run through bin/ansible-python.sh, so PyYAML
needs no separate installation) now decides which roles need to be
(re)installed and only passes those to agru or ansible-galaxy:
- missing roles are installed, and outdated roles are replaced
- outdated roles which were changed since they were installed are kept,
with a warning. Changes are detected by comparing the role's contents
with a checksum recorded at installation, in run/installed-roles.yml.
Roles installed before (without a checksum) are considered unchanged.
- outdated roles which were not installed by agru or ansible-galaxy
are kept, with a warning
- symlinked roles and roles containing a `.git` directory are never
touched
`just roles --force` replaces changed roles too. `just update -u` now
only updates the pinned versions with agru and leaves installing the
roles to the script, so that it keeps changed roles as well.
The same script in mash-playbook (where its tests live, and where it
also deletes the roles of services no longer in use):
https://github.com/mother-of-all-self-hosting/mash-playbook/commit/d5c5e0cehttps://github.com/mother-of-all-self-hosting/mash-playbook/commit/608a7943
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>