ganeti-ansible/roles/node/tasks/xen.yml

101 lines
2.7 KiB
YAML
Raw Permalink Normal View History

2025-02-24 00:48:14 +00:00
- name: "Set Xen commandline"
ansible.builtin.lineinfile:
path: "/etc/default/grub.d/xen.cfg"
regexp: '^GRUB_CMDLINE_XEN_DEFAULT=.*$'
line: 'GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=1024M,max:1024M dom0_max_vcpus=2 dom0_vcpus_pin loglvl=all guest_loglvl=all iommu=debug,verbose apic_verbosity=debug ivrs_ioapic[0]=00:14.0" console=com1 com1=115200'
notify:
- update grub
- name: "Set CPU pinning from dom0"
ansible.builtin.replace:
path: "/etc/xen/xl.conf"
regexp: '^#vm.cpumask=.*$'
replace: 'vm.cpumask="2-7"'
notify:
- update grub
- name: "Disable ballooning for dom0"
ansible.builtin.replace:
path: "/etc/xen/xl.conf"
regexp: '^#autoballoon=.*$'
replace: 'autoballoon="0"'
notify:
- update grub
- name: "Disable domain saving"
ansible.builtin.lineinfile:
path: "/etc/default/xendomains"
regexp: '^XENDOMAINS_SAVE=.*$'
line: 'XENDOMAINS_SAVE='
notify:
- update grub
- name: "Disable domain restore"
ansible.builtin.lineinfile:
path: "/etc/default/xendomains"
regexp: '^XENDOMAINS_RESTORE=.*$'
line: 'XENDOMAINS_RESTORE=false'
notify:
- update grub
- name: "Get latest kernel"
ansible.builtin.command:
cmd: bash -c 'find /boot -name "vmlinuz*" | sort -r | head -1'
register: latest_kernel
changed_when: false
failed_when: latest_kernel.rc != 0
- name: "Symlink to the latest kernel"
ansible.builtin.file:
state: link
src: "{{ latest_kernel.stdout }}"
dest: "/boot/vmlinuz-3-xenU"
- name: "Get latest initrd"
ansible.builtin.command:
cmd: bash -c 'find /boot -name "initrd.img*" | sort -r | head -1'
register: latest_initrd
changed_when: false
failed_when: latest_initrd.rc != 0
- name: "Symlink to initrd"
ansible.builtin.file:
state: link
src: "{{ latest_initrd.stdout }}"
dest: "/boot/initrd.img-3-xenU"
- name: "Get latest kernel config"
ansible.builtin.command:
cmd: bash -c 'find /boot -name "config*" | sort -r | head -1'
register: latest_config
changed_when: false
failed_when: latest_config.rc != 0
- name: "Symlink to kernel config"
ansible.builtin.file:
state: link
src: "{{ latest_config.stdout }}"
dest: "/boot/config-3-xenU"
- name: "Add Xen block drivers to modules"
ansible.builtin.lineinfile:
path: "/etc/initramfs-tools/modules"
regexp: "xen_blkfront"
line: "xen_blkfront"
notify:
- update initramfs
- reboot
2025-02-25 13:45:19 +00:00
- name: "Get latest Xen version"
ansible.builtin.command:
cmd: bash -c 'find /usr/lib -type d -name "xen-*" | sort -r | head -1'
register: latest_xen
changed_when: false
failed_when: latest_xen.rc != 0
- name: "Link Xen to latest version"
ansible.builtin.file:
state: link
src: "{{ latest_xen.stdout }}"
dest: /usr/lib/xen