Files
homelab-infra/infrastructure/proxmox/ansible/roles/pve_kernel_params/tasks/main.yml
T
panxiao81 2e05b1a96a
yaml / yaml (pull_request) Failing after 25s
terraform / validate (pull_request) Successful in 51s
ansible / collection-test (pull_request) Successful in 1m27s
ansible / lint (pull_request) Successful in 3m45s
声明式管理 Proxmox API 对象与 Samba DNS 上游
2026-09-17 13:22:50 +00:00

33 lines
1.2 KiB
YAML

---
# Per-host kernel cmdline additions, driven by `pve_kernel_cmdline_extra` in the
# inventory. No node currently sets it; keep the role for future kernel parameters.
#
# This is a no-op on hosts that do not define the variable.
- name: Set GRUB_CMDLINE_LINUX_DEFAULT
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT='
line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet {{ pve_kernel_cmdline_extra }}"'
backup: true
when: pve_kernel_cmdline_extra is defined and pve_kernel_cmdline_extra | length > 0
notify: Update grub
- name: Check which extra params are actually active
# /proc/cmdline is the only honest source: editing grub without running
# update-grub, or rebooting, silently leaves the fix inactive.
ansible.builtin.command:
cmd: cat /proc/cmdline
register: _cmdline
changed_when: false
- name: Warn when a configured param is not yet live
ansible.builtin.debug:
msg: >-
{{ inventory_hostname }}: "{{ item }}" is configured but NOT active in
/proc/cmdline -- a reboot is required for it to take effect.
loop: "{{ pve_kernel_cmdline_extra.split() }}"
when:
- pve_kernel_cmdline_extra is defined and pve_kernel_cmdline_extra | length > 0
- item not in _cmdline.stdout