xen.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. - name: 'Install Xen related packages'
  2. apt:
  3. pkg: '{{ item }}'
  4. install_recommends: 'no'
  5. state: 'present'
  6. with_items:
  7. - 'xen-linux-system-amd64'
  8. - 'grub-xen-host'
  9. - 'bridge-utils'
  10. - 'debootstrap'
  11. when: with_xen
  12. - name: 'Add GRUB options for Xen'
  13. lineinfile:
  14. dest: '/etc/default/grub'
  15. regexp: '^GRUB_CMDLINE_XEN_DEFAULT='
  16. insertafter: '^GRUB_CMDLINE_LINUX='
  17. line: 'GRUB_CMDLINE_XEN_DEFAULT="dom0_mem={{ xendom0_mem }}M,max:{{ xendom0_mem }}M dom0_max_vcpus=1 dom0_vcpus_pin {{ xen_grub_opts }}"'
  18. notify:
  19. - 'Update GRUB'
  20. when: with_xen
  21. - name: 'Set Xen hypervisor to boot first'
  22. command: 'dpkg-divert --divert /etc/grub.d/09_linux_xen --rename /etc/grub.d/20_linux_xen creates=/etc/grub.d/09_linux_xen'
  23. notify:
  24. - 'Update GRUB'
  25. when: with_xen
  26. - name: 'Configure Xend'
  27. template:
  28. src: 'xen/xend-config.sxp.j2'
  29. dest: '/etc/xen/xend-config.sxp'
  30. owner: 'root'
  31. group: 'root'
  32. mode: '0644'
  33. when: with_xen
  34. - name: 'Configure Xendomains init script (disable save and restore)'
  35. lineinfile:
  36. dest: '/etc/default/xendomains'
  37. regexp: '{{ item.regexp }}'
  38. line: '{{ item.line }}'
  39. with_items:
  40. - { regexp: '^#?XENDOMAINS_RESTORE=', line: 'XENDOMAINS_RESTORE=false' }
  41. - { regexp: '^#?XENDOMAINS_SAVE=', line: 'XENDOMAINS_SAVE=' }
  42. when: with_xen