ansible-legacy/roles/libvirthost/tasks/main.yml

86 lines
1.7 KiB
YAML
Raw Normal View History

2019-11-02 20:35:55 +00:00
---
- name: install packages
apt:
state: latest
pkg:
- libvirt-daemon
- libvirt-daemon-system
- qemu-system-x86
- bridge-utils
- ovmf
- nvme-cli
- lm-sensors
- libhugetlbfs-bin
- iotop
install_recommends: no
force_apt_get: yes
become: yes
- name: copy config files, scripts and services
copy:
src: "{{ item }}"
dest: "/{{ item }}"
force: yes
mode: preserve
become: yes
with_items:
- etc/default/grub.d/
- etc/modules-load.d/
- etc/modprobe.d/
- etc/network/interfaces.d/
- etc/systemd/system/
- etc/libvirt/hooks/
- usr/local/bin/
- name: hugepages config
lineinfile:
state: present
path: /etc/fstab
regexp: "^hugetlbfs"
line: "hugetlbfs /dev/hugepages hugetlbfs defaults 0 0"
become: yes
- name: add user to grups
user:
name: plantroon
groups: libvirt,kvm
append: yes
become: yes
- name: kernel param tuning
sysctl:
state: present
name: "{{ item.name }}"
value: "{{ item.value }}"
sysctl_file: /etc/sysctl.d/vfio.conf
reload: yes
become: yes
with_items:
#TOTAL_RAM/2048kB (size in proc/meminfo) 13824 for 32 gig
- { name: 'vm.nr_hugepages', value: '32' }
- { name: 'vm.stat_interval', value: '120' }
- { name: 'kernel.watchdog', value: '0' }
- name: enable tuning service
systemd:
name: kvm-tuning
state: started
enabled: yes
become: yes
- name: enable restore_rift service
systemd:
name: restore_rift
state: started
enabled: yes
become: yes
- name: update grub configs to reflect the above changes
command: update-grub
become: yes
- name: update initramfs
command: "update-initramfs -u"
become: yes