|
|
|
@ -1,29 +1,38 @@ |
|
|
|
|
- name: set cpu scheduler in cron |
|
|
|
|
cron: |
|
|
|
|
name: set cpu scheduler |
|
|
|
|
special_time: reboot |
|
|
|
|
job: 'echo {{ cpu_governor | quote }} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor > /dev/null' |
|
|
|
|
user: root |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: install extra proxmox packages |
|
|
|
|
package: |
|
|
|
|
name: "{{ item }}" |
|
|
|
|
loop: "{{ proxmox_default_packages + (proxmox_packages | d([])) }}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block: |
|
|
|
|
- name: get current cpu scheduler types |
|
|
|
|
shell: |
|
|
|
|
cmd: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor |
|
|
|
|
register: result |
|
|
|
|
changed_when: false |
|
|
|
|
- name: set cpu scheduler in cron |
|
|
|
|
cron: |
|
|
|
|
name: set cpu scheduler |
|
|
|
|
special_time: reboot |
|
|
|
|
job: 'echo {{ proxmox_cfg.cpu_governor | quote }} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor > /dev/null' |
|
|
|
|
user: root |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- block: |
|
|
|
|
- name: get current cpu scheduler types |
|
|
|
|
shell: |
|
|
|
|
cmd: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor |
|
|
|
|
register: result |
|
|
|
|
changed_when: no |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: change cpu scheduler |
|
|
|
|
shell: |
|
|
|
|
cmd: 'echo {{ cpu_governor | quote }} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor' |
|
|
|
|
when: (result.stdout_lines | unique | length > 1) or ((result.stdout_lines | unique)[0] != cpu_governor) |
|
|
|
|
- name: change cpu scheduler |
|
|
|
|
shell: |
|
|
|
|
cmd: 'echo {{ proxmox_cfg.cpu_governor | quote }} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor' |
|
|
|
|
when: (result.stdout_lines | unique | length > 1) or ((result.stdout_lines | unique)[0] != proxmox_cfg.cpu_governor) |
|
|
|
|
|
|
|
|
|
rescue: |
|
|
|
|
- name: report that cpu scheduler cannot be changed |
|
|
|
|
debug: |
|
|
|
|
msg: failed to change cpu scheduler |
|
|
|
|
rescue: |
|
|
|
|
- name: report that cpu scheduler cannot be changed |
|
|
|
|
debug: |
|
|
|
|
msg: failed to change cpu scheduler |
|
|
|
|
|
|
|
|
|
when: proxmox_cfg.cpu_governor is string |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: disable enterprise repo |
|
|
|
|
apt_repository: |
|
|
|
@ -44,17 +53,13 @@ |
|
|
|
|
- name: set datacenter configuration |
|
|
|
|
lineinfile: |
|
|
|
|
path: /etc/pve/datacenter.cfg |
|
|
|
|
regexp: "^{{ item.name }}: " |
|
|
|
|
line: "{{ item.name }}: {{ item.value }}" |
|
|
|
|
regexp: "^{{ item.key }}: " |
|
|
|
|
line: "{{ item.key }}: {{ item.value }}" |
|
|
|
|
mode: 0640 |
|
|
|
|
owner: root |
|
|
|
|
group: www-data |
|
|
|
|
create: yes |
|
|
|
|
loop: |
|
|
|
|
- name: mac_prefix |
|
|
|
|
value: "{{ mac_prefix }}" |
|
|
|
|
- name: email_from |
|
|
|
|
value: "{{ host_name }}@{{ mail_server.tld | d(tld) }}" |
|
|
|
|
loop: "{{ proxmox_cfg.datacenter | dict2items }}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: enable auto-reboot on kernel panic |
|
|
|
@ -62,13 +67,14 @@ |
|
|
|
|
dest: /etc/sysctl.d/90-auto-reboot.conf |
|
|
|
|
content: "kernel.panic = 5\n" |
|
|
|
|
mode: 0644 |
|
|
|
|
when: proxmox_cfg.auto_reboot | d(true) == true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: set max arc cache size for zfs |
|
|
|
|
lineinfile: |
|
|
|
|
path: /etc/modprobe.d/zfs.conf |
|
|
|
|
regexp: "^options zfs zfs_arc_max=" |
|
|
|
|
line: "options zfs zfs_arc_max={{ zfs_arc_max }}" |
|
|
|
|
line: "options zfs zfs_arc_max={{ proxmox_cfg.zfs_arc_max }}" |
|
|
|
|
create: yes |
|
|
|
|
mode: 0644 |
|
|
|
|
when: zfs_arc_max is defined |
|
|
|
|
when: proxmox_cfg.zfs_arc_max is defined |
|
|
|
|