fix(ansible): replace deprecated entities and sync version requirements (#478)

* refactor(ansible): replace deprecated with_items and ansible facts

Replace deprecated `with_items` with `loop` keyword across all roles.
Migrate from legacy `ansible_*` top-level facts to `ansible_facts['*']`
syntax to prepare for ansible-core 2.24 where INJECT_FACTS_AS_VARS
will default to False.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>

* chore(ansible): sync minimum version requirements to 2.15

Align version checks in prereq and airgap roles with README requirement
of ansible-core 2.15+.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>

---------

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Aleksei Sviridkin
2025-12-22 21:11:29 +03:00
committed by GitHub
parent e11ff62d8f
commit 826c53975d
10 changed files with 31 additions and 31 deletions

View File

@@ -43,6 +43,6 @@
ansible.builtin.include_tasks: "{{ item }}"
with_first_found:
- "prereq/{{ detected_distribution }}.yml"
- "prereq/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "prereq/{{ ansible_distribution }}.yml"
- "prereq/{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml"
- "prereq/{{ ansible_facts['distribution'] }}.yml"
- "prereq/default.yml"

View File

@@ -4,7 +4,7 @@
path: /boot/boot.txt
regexp: '^(setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr="\${usbethaddr}"(?!.*\b{{ cgroup_item }}\b).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
loop:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"

View File

@@ -4,7 +4,7 @@
path: /boot/cmdline.txt
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
loop:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"

View File

@@ -9,7 +9,7 @@
path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}"
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
loop:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"

View File

@@ -9,7 +9,7 @@
path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}"
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
loop:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"

View File

@@ -9,7 +9,7 @@
path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/firmware/current/cmdline.txt') }}"
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
loop:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"
@@ -24,4 +24,4 @@
name: linux-modules-extra-raspi
update_cache: "{{ airgap_dir is not defined }}"
state: present
when: "ansible_distribution_version is version('20.10', '>=') and ansible_distribution_version is version('24.04', '<')"
when: "ansible_facts['distribution_version'] is version('20.10', '>=') and ansible_facts['distribution_version'] is version('24.04', '<')"