Files
computer-playbook/roles/web-app-dashboard/tasks/03_simpleicons_refresh.yml
kevinveenbirkenbachandClaude Opus 4.8 23d1447566 refactor(ansible): add path_absolute lookup, replace playbook_dir joins
Introduce plugins/lookup/path_absolute.py as the single source for the
repo-root anchor: lookup('path_absolute', 'roles/...') returns an absolute
path under playbook_dir, joining every term. Replace all hand-built
playbook_dir path constructions across .yml/.yaml and .j2 templates with it:

  [playbook_dir, '<rel>'] | path_join   -> lookup('path_absolute', '<rel>')
  playbook_dir ~ '/<rel>'               -> lookup('path_absolute', '<rel>')
  {{ playbook_dir }}/<rel>              -> lookup('path_absolute', '<rel>')

Unrelated repo_path symbols in cli/meta/roles/applications/resolution and the
single bare discover_playwright_roles(playbook_dir) call are left untouched.

Add tests/lint/ansible/test_playbook_dir_via_lookup.py: fails the build if any
of the three construction forms reappears in .yml/.yaml/.j2, pointing callers
at the lookup. Unit test covers the plugin.

Touching these files pulled their pre-existing narration comments into
test_comments_valid scope; clean them (delete restatement/banners, keep real
trip-wires as Workaround/Upstream/Invariant markers). Drop caution, important
and pitfall from the comment-lint marker vocabulary and remove the comments
that used them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 20:36:57 +02:00

51 lines
1.8 KiB
YAML

---
- name: ⏳ Wait for a known Simple Icons asset before rebuilding dashboard cards
uri_retry:
url: "{{ DASHBOARD_SIMPLEICONS_SYNC_URL_BASE }}keycloak.svg"
status_code: 200
validate_certs: false
register: simpleicons_http
retries: 60
delay: 5
until: simpleicons_http.status == 200
- name: 🔍 Probe Simple Icons reachability per card slug (on the stack host)
uri_retry:
url: "{{ DASHBOARD_SIMPLEICONS_SYNC_URL_BASE }}{{ item }}.svg"
method: HEAD
status_code: [200, 404]
validate_certs: false
register: dashboard_simpleicons_probe
loop: "{{ portfolio_cards | simpleicon_slugs }}"
loop_control:
label: "{{ item }}"
delegate_to: "{{ STACK_HOST }}"
run_once: true
changed_when: false
- name: 🔄 Reload docker cards once Simple Icons is reachable
set_fact:
portfolio_cards: >-
{{ portfolio_cards | add_simpleicon_source(
dashboard_simpleicons_probe.results
| selectattr('status', 'equalto', 200)
| map(attribute='item')
| list,
DASHBOARD_SIMPLEICONS_URL_BASE) }}
changed_when: false
- name: 🐳 Regroup docker cards after Simple Icons refresh
set_fact:
portfolio_menu_data: "{{ lookup('docker_cards_grouped', portfolio_cards, portfolio_menu_categories) }}"
- name: "🔄 Refresh Dashboard config.yaml once Simple Icons is reachable (local + swarm)"
ansible.builtin.include_tasks:
file: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/render_replicated_templates.yml') }}"
vars:
role_templates:
- src: "{{ DASHBOARD_CONFIG_INV_PATH if config_file.stat.exists else DASHBOARD_CONFIG_YML_SRC_FILE }}"
dest: "{{ DASHBOARD_CONFIG_YML_DEST }}"
- name: 🚿 Flush compose handlers after Simple Icons refresh
meta: flush_handlers