xen.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. - name: 'Install Xen related packages'
  2. apt:
  3. pkg: '{{ item }}'
  4. install_recommends: 'no'
  5. state: 'installed'
  6. update_cache: 'yes'
  7. with_items:
  8. - 'xen-linux-system-amd64'
  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"'
  18. when: with_xen
  19. - name: 'Set Xen hypervisor to boot first'
  20. command: 'dpkg-divert --divert /etc/grub.d/09_linux_xen --rename /etc/grub.d/20_linux_xen creates=/etc/grub.d/09_linux_xen'
  21. notify:
  22. - 'Update GRUB'
  23. when: with_xen
  24. - name: 'Configure Xend'
  25. template:
  26. src: 'xen/xend-config.sxp.j2'
  27. dest: '/etc/xen/xend-config.sxp'
  28. owner: 'root'
  29. group: 'root'
  30. mode: '0644'
  31. when: with_xen
  32. - name: 'Configure Xendomains init script (disable save and restore)'
  33. lineinfile:
  34. dest: '/etc/default/xendomains'
  35. regexp: '{{ item.regexp }}'
  36. line: '{{ item.line }}'
  37. with_items:
  38. - { regexp: '^#?XENDOMAINS_RESTORE=', line: 'XENDOMAINS_RESTORE=false' }
  39. - { regexp: '^#?XENDOMAINS_SAVE=', line: 'XENDOMAINS_SAVE=' }
  40. when: with_xen