Skip to content

Commit

Permalink
Merge pull request #1893 from nicomiguelino/fix-1892
Browse files Browse the repository at this point in the history
Sets `cmdline.txt` path conditionally
  • Loading branch information
nicomiguelino authored May 14, 2024
2 parents 7b559ef + 166858f commit 2efa555
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ansible/roles/system/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- name: Create a config_path variable
ansible.builtin.set_fact:
config_path: "{{ '/boot/config.txt' if ansible_distribution_major_version|int <= 11 else '/boot/firmware/config.txt' }}"

Check warning on line 4 in ansible/roles/system/tasks/main.yml

View workflow job for this annotation

GitHub Actions / build

jinja[spacing]

Jinja2 spacing could be improved: {{ '/boot/cmdline.txt' if ansible_distribution_major_version|int <= 11 else '/boot/firmware/cmdline.txt' }} -> {{ '/boot/cmdline.txt' if ansible_distribution_major_version | int <= 11 else '/boot/firmware/cmdline.txt' }}

Check warning on line 4 in ansible/roles/system/tasks/main.yml

View workflow job for this annotation

GitHub Actions / build

jinja[spacing]

Jinja2 spacing could be improved: {{ '/boot/config.txt' if ansible_distribution_major_version|int <= 11 else '/boot/firmware/config.txt' }} -> {{ '/boot/config.txt' if ansible_distribution_major_version | int <= 11 else '/boot/firmware/config.txt' }}
cmdline_path: "{{ '/boot/cmdline.txt' if ansible_distribution_major_version|int <= 11 else '/boot/firmware/cmdline.txt' }}"

- name: Check NOOBS
ansible.builtin.command: cat {{ config_path }}
Expand Down Expand Up @@ -80,8 +81,8 @@

- name: Backup kernel boot args
ansible.builtin.copy:
src: /boot/cmdline.txt
dest: /boot/cmdline.txt.orig
src: "{{ cmdline_path }}"
dest: "{{ cmdline_path }}.orig"
owner: root
group: root
mode: "0755"
Expand All @@ -95,8 +96,8 @@

- name: Copy cmdline.txt.orig to cmdline.txt
ansible.builtin.copy:
src: /boot/cmdline.txt.orig
dest: /boot/cmdline.txt
src: "{{ cmdline_path }}.orig"
dest: "{{ cmdline_path }}"
owner: root
group: root
mode: "0755"
Expand All @@ -107,14 +108,14 @@

- name: For splash screen using Plymouth
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!splash).)*$)
replace: \1 splash
when: ansible_distribution_major_version|int >= 7

- name: Remove blinking cursor
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!vt.global_cursor_default=0).)*$)
replace: \1 vt.global_cursor_default=0
when: ansible_distribution_major_version|int >= 7
Expand All @@ -123,7 +124,7 @@

- name: Plymouth ignore serial consoles
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!plymouth.ignore-serial-consoles).)*$)
replace: \1 plymouth.ignore-serial-consoles
when: ansible_distribution_major_version|int >= 7
Expand All @@ -132,23 +133,23 @@

- name: Use Systemd as init and quiet boot process
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!quiet init=/lib/systemd/systemd).)*$)
replace: \1 quiet init=/lib/systemd/systemd
tags:
- touches_boot_partition

- name: Set ethN/wlanN names for interfaces
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!net\.ifnames=0).)*$)
replace: \1 net.ifnames=0
tags:
- touches_boot_partition

- name: Set cgroup_enable required by containerd for OOM
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!cgroup_enable=memory).)*$)
replace: \1 cgroup_enable=memory
when: ansible_distribution_major_version|int >= 7
Expand All @@ -157,7 +158,7 @@

- name: Set cgroup_memory required by containerd for OOM
ansible.builtin.replace:
dest: /boot/cmdline.txt
dest: "{{ cmdline_path }}"
regexp: (^(?!$)((?!cgroup_memory=1).)*$)
replace: \1 cgroup_memory=1
when: ansible_distribution_major_version|int >= 7
Expand Down

0 comments on commit 2efa555

Please sign in to comment.