xen.yml 1.4 KB

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