[PATCH 08/12] linux-mirror: fix variable path in mirror-status debug tasks
Daniel Gomez <[email protected]> Thu, 06 Nov 2025 23:36:02 +0100
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
From: Daniel Gomez <[email protected]> The "Service status" and "Service timer status" debug tasks were attempting to iterate over mirror_service_status.item and mirror_timer_status.item, but these variables don't exist. When using register with a looped task, Ansible stores the results in a .results list, not .item. Additionally, the tasks were using var with Jinja2 templating, which Ansible treats as untrusted. The var parameter expects a plain variable name, not a templated expression. Use msg instead for templated output. Change both debug tasks to use msg with proper templating and loop over the .results list. Also modernize with_items to loop syntax. Now sudo make mirror-status correctly displays the status of all mirror services and timers. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]> --- playbooks/roles/linux-mirror/tasks/main.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/playbooks/roles/linux-mirror/tasks/main.yml b/playbooks/roles/linux-mirror/tasks/main.yml index 74e980ff..e90917f3 100644 --- a/playbooks/roles/linux-mirror/tasks/main.yml +++ b/playbooks/roles/linux-mirror/tasks/main.yml @@ -179,9 +179,8 @@ - name: Service status ansible.builtin.debug: - var: "{{ item }}.status.ActiveState" - with_items: - - "{{ mirror_service_status.item }}" + msg: "{{ item.status.ActiveState }}" + loop: "{{ mirror_service_status.results }}" tags: ["mirror-status"] when: - not install_only_git_daemon|bool @@ -201,9 +200,8 @@ - name: Service timer status ansible.builtin.debug: - var: "{{ item }}.status.ActiveState" - with_items: - - "{{ mirror_timer_status.item }}" + msg: "{{ item.status.ActiveState }}" + loop: "{{ mirror_timer_status.results }}" tags: ["mirror-status"] when: - not install_only_git_daemon|bool -- 2.51.0