From 3557fe3f2b941d05287d93c9165710385da428bb Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Sat, 19 Sep 2026 19:10:44 +0200 Subject: [PATCH] Skip the layout guard under --check Under --check the git task reports "changed" without writing anything, so on a host that has not been deployed yet there is no checkout to stat and the guard fired on a perfectly fine configuration - making `just check mediapis.yml musicdolphin` fail before the first real run. Co-Authored-By: Claude Opus 5 --- roles/pi_musicmouse/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/pi_musicmouse/tasks/main.yml b/roles/pi_musicmouse/tasks/main.yml index 85f77ca..7a418ff 100644 --- a/roles/pi_musicmouse/tasks/main.yml +++ b/roles/pi_musicmouse/tasks/main.yml @@ -46,6 +46,9 @@ ansible.builtin.stat: path: /opt/musicmouse/python-backend/pyproject.toml register: pi_musicmouse_pyproject + # Meaningless under --check on a host that has never been deployed: the git task + # above reports "changed" without writing anything, so there is nothing to stat. + when: not ansible_check_mode - name: Fail on a pre-rearchitecture checkout ansible.builtin.fail: @@ -57,7 +60,7 @@ mediapi_install_kidsmusic to false for this host and leave whatever is installed alone. Stopping here rather than failing three tasks deeper with the real reason buried. - when: not pi_musicmouse_pyproject.stat.exists + when: not ansible_check_mode and not pi_musicmouse_pyproject.stat.exists - name: Create virtualenv with Python {{ pi_musicmouse_python_version }} ansible.builtin.command: