xen.yml 1.3 KB

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