Skip to content

Commit 07467b1

Browse files
authored
Merge pull request #187 from ilifu/bugfix
Use ansible_facts[] instead of injected top-level facts
2 parents 954a8da + 58ff247 commit 07467b1

74 files changed

Lines changed: 441 additions & 378 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/add-software/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ An install runs **only when both tags are supplied**:
8383
community.general.make:
8484
chdir: "{{ unzip_dir }}"
8585
environment:
86-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
86+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
8787
- name: Install <software> {{ version_number }}
8888
community.general.make:
8989
chdir: "{{ unzip_dir }}"

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,17 @@ jobs:
3131
- name: ansible-lint
3232
working-directory: ansible
3333
run: uv run ansible-lint
34+
35+
# ansible-lint ships no rule for this, so it needs its own gate. Facts must
36+
# be read as ansible_facts['name']; the bare injected form is deprecated in
37+
# ansible-core 2.21 and removed in 2.24. Covers the non-YAML templates
38+
# (.def/.sh/.lua/.j2) that neither linter looks at.
39+
- name: Reject bare injected facts
40+
working-directory: ansible
41+
run: |
42+
if grep -rnE '\bansible_(env|processor_vcpus|processor_count|architecture)\b' \
43+
--include='*.yml' --include='*.yaml' --include='*.def' \
44+
--include='*.j2' --include='*.lua' --include='*.sh' .; then
45+
echo "::error::Use ansible_facts['name'] - top-level fact injection is removed in ansible-core 2.24"
46+
exit 1
47+
fi

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,8 @@ uv run ansible-lint # target profile: production
8989
`vars:` must be a **mapping, not a list**.
9090
- Unpack into **`/dev/shm`**; use **`creates:`** on build commands for idempotency.
9191
- Keep any Jinja template at the **end** of a task `name:`.
92+
- **Facts via `ansible_facts['name']`**, never the bare injected `ansible_processor_vcpus`
93+
/ `ansible_env` form — top-level injection is deprecated in ansible-core 2.21 and removed
94+
in 2.24. `ansible.cfg` sets `inject_facts_as_vars = False`, so a bare reference fails at
95+
runtime; a CI grep step gates it at PR time (ansible-lint has no rule for this). Magic and
96+
connection vars (`ansible_run_tags`, `ansible_connection`) are unaffected.

ansible/ansible.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ ansible_connection = ssh
33
inventory = ./inventory
44
roles_path = ./roles
55
gathering = smart
6+
# Facts are consumed via ansible_facts['name']; top-level injection is removed
7+
# in ansible-core 2.24. Disabling it now makes any missed bare `ansible_*`
8+
# reference fail loudly instead of silently resolving to the wrong thing.
9+
inject_facts_as_vars = False
610
# fact_caching = redis
711

812

ansible/group_vars/all

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ python_dir: "{{ common_dir }}/python"
2828
uv_version: "0.11.23"
2929
uv_dir: "{{ common_dir }}/uv"
3030
uv: "{{ uv_dir }}/{{ uv_version }}/bin/uv"
31-
uv_arch: "{{ ansible_architecture }}" # x86_64 / aarch64
31+
uv_arch: "{{ ansible_facts['architecture'] }}" # x86_64 / aarch64
3232
uv_checksums:
3333
x86_64: "sha256:e12c4cda2fe8c305510a78380a88f2c32a27e90cdcd123cefd2873388f0ebb5f"
3434
aarch64: "sha256:1873a77350f6621279ae1a0d2227f2bd8b67131598f14a7eb0ba2215d3da2c98"

ansible/roles/compiled/tasks/astro/calceph.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Install calceph
33
environment:
4-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
4+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
55
FFLAGS: "-fallow-argument-mismatch"
66
CC: "gcc-10"
77
FC: "gfortran-10"

ansible/roles/compiled/tasks/astro/cfitsio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
community.general.make:
3434
chdir: "{{ unzipdir }}"
3535
environment:
36-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
36+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
3737

3838
- name: Build cfitsio shared {{ version_number }}
3939
when: "'3.' in version_number"
4040
community.general.make:
4141
chdir: "{{ unzipdir }}"
4242
target: shared
4343
environment:
44-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
44+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
4545

4646
- name: Install cfitsio {{ version_number }}
4747
community.general.make:

ansible/roles/compiled/tasks/bio/ambertools.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
- never
2323
- ambertools{{ item.version_number }}
2424
environment:
25-
PATH: "{{ cuda_root }}/bin:{{ mpi_root }}/bin:{{ hwloc_root }}/bin:{{ python_root }}/bin:{{ ansible_env.PATH }}"
26-
INCLUDE: "{{ cuda_root }}/include:{{ mpi_root }}/include:{{ hwloc_root }}/include:{{ python_root }}/include{% if 'INCLUDE' in ansible_env %}:{{ ansible_env.INCLUDE
25+
PATH: "{{ cuda_root }}/bin:{{ mpi_root }}/bin:{{ hwloc_root }}/bin:{{ python_root }}/bin:{{ ansible_facts['env'].PATH }}"
26+
INCLUDE: "{{ cuda_root }}/include:{{ mpi_root }}/include:{{ hwloc_root }}/include:{{ python_root }}/include{% if 'INCLUDE' in ansible_facts['env'] %}:{{ ansible_facts['env'].INCLUDE
2727
}}{% endif %}"
28-
LD_LIBRARY_PATH: "{{ cuda_root }}/lib64:{{ mpi_root }}/lib:{{ hwloc_root }}/lib:{{ python_root }}/lib{% if 'LD_LIBRARY_PATH' in ansible_env %}:{{ ansible_env.LD_LIBRARY_PATH
28+
LD_LIBRARY_PATH: "{{ cuda_root }}/lib64:{{ mpi_root }}/lib:{{ hwloc_root }}/lib:{{ python_root }}/lib{% if 'LD_LIBRARY_PATH' in ansible_facts['env'] %}:{{ ansible_facts['env'].LD_LIBRARY_PATH
2929
}}{% endif %}"
3030
PKG_CONFIG_PATH: "{{ cuda_root }}/pkgconfig:{{ mpi_root }}/lib/pkgconfig:{{ hwloc_root }}/lib/pkgconfig:{{ python_root }}/lib/pkgconfig{% if 'PKG_CONFIG_PATH'
31-
in ansible_env %}:{{ ansible_env.PKG_CONFIG_PATH }}{% endif %}"
32-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
31+
in ansible_facts['env'] %}:{{ ansible_facts['env'].PKG_CONFIG_PATH }}{% endif %}"
32+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
3333
CUDA_PATH: "{{ cuda_root }}"
3434
CUDA_DIR: "{{ cuda_root }}"
3535
block:

ansible/roles/compiled/tasks/bio/bamtools.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
community.general.make:
4949
chdir: "{{ unzip_dir }}/build"
5050
target: all
51-
jobs: "{{ ansible_processor_count }}"
51+
jobs: "{{ ansible_facts['processor_count'] }}"
5252
params:
5353
DESTDIR: "{{ unzip_dir }}/staging"
5454
environment:
55-
MAKEFLAGS: "-j {{ ansible_processor_count }}"
55+
MAKEFLAGS: "-j {{ ansible_facts['processor_count'] }}"
5656

5757
- name: Run make install
5858
community.general.make:

ansible/roles/compiled/tasks/bio/bcftools.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
community.general.make:
4040
chdir: "{{ unzip_dir }}"
4141
environment:
42-
MAKEFLAGS: "-j {{ ansible_processor_vcpus }}"
42+
MAKEFLAGS: "-j {{ ansible_facts['processor_vcpus'] }}"
4343
- name: Install bcftools {{ version_number }} to {{ install_dir }}
4444
community.general.make:
4545
chdir: "{{ unzip_dir }}"

0 commit comments

Comments
 (0)