59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
---
|
|
# file: tasks/boot.yml
|
|
|
|
- name: boot - define config
|
|
set_fact:
|
|
boot_config:
|
|
# set docker optimizations - armbian
|
|
- dest: /boot/armbianEnv.txt
|
|
line: 'docker_optimizations=on'
|
|
regex: ''
|
|
# set clocksource - grub
|
|
- dest: /etc/default/grub
|
|
line: 'GRUB_CMDLINE_LINUX="\1 clocksource=tsc tsc=reliable"'
|
|
regex: '^GRUB_CMDLINE_LINUX="((?!.*clocksource=tsc tsc=reliable).*)"$'
|
|
# set resources limits - grub
|
|
- dest: /etc/default/grub
|
|
line: 'GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory swapaccount=1"'
|
|
regex: '^GRUB_CMDLINE_LINUX="((?!.*cgroup_enable=memory swapaccount=1).*)"$'
|
|
# set clocksource - syslinux
|
|
- dest: /etc/update-extlinux.conf
|
|
line: 'default_kernel_opts="\1 clocksource=tsc tsc=reliable"'
|
|
regex: '^default_kernel_opts="((?!.*clocksource=tsc tsc=reliable).*)"$'
|
|
# set resources limits - syslinux
|
|
- dest: /etc/update-extlinux.conf
|
|
line: 'default_kernel_opts="\1 cgroup_enable=memory swapaccount=1"'
|
|
regex: '^default_kernel_opts="((?!.*cgroup_enable=memory swapaccount=1).*)"$'
|
|
# set clocksource - uboot
|
|
- dest: /boot/cmdline.txt
|
|
line: '\1 clocksource=tsc tsc=reliable'
|
|
regex: '^((?!.*clocksource=tsc tsc=reliable).*)$'
|
|
# set resources limits - uboot
|
|
- dest: /boot/cmdline.txt
|
|
line: '\1 cgroup_enable=memory swapaccount=1'
|
|
regex: '^((?!.*cgroup_enable=memory swapaccount=1).*)$'
|
|
|
|
- name: boot - stat config file
|
|
with_items: '{{boot_config|default([])}}'
|
|
stat:
|
|
path: '{{item.dest}}'
|
|
changed_when: false
|
|
register: boot_config_stat
|
|
|
|
- name: boot - update config
|
|
when: item.1.stat.exists
|
|
with_together:
|
|
- '{{boot_config|default([])}}'
|
|
- '{{boot_config_stat.results}}'
|
|
lineinfile:
|
|
backrefs: true
|
|
dest: '{{item.0.dest}}'
|
|
line: '{{item.0.line}}'
|
|
regex: '{{item.0.regex}}'
|
|
become: yes
|
|
notify:
|
|
- update boot - syslinux
|
|
- update boot - grub
|
|
register: boot_config_handler_notify
|
|
|