New version of salt-formula from Saltstack
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

8 lat temu
8 lat temu
8 lat temu
8 lat temu
8 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {% from "salt/map.jinja" import control with context %}
  2. {%- if control.enabled and control.virt_enabled is defined %}
  3. include:
  4. - salt.minion
  5. salt_control_virt_packages:
  6. pkg.installed:
  7. - names: {{ control.virt_pkgs }}
  8. {% if grains.oscodename == 'trusty' %}
  9. {#- This tool is not available in newer releases #}
  10. update-guestfs-appliance:
  11. cmd.wait:
  12. - watch:
  13. - pkg: salt_control_virt_packages
  14. {%- endif %}
  15. {%- for cluster_name, cluster in control.cluster.iteritems() %}
  16. {%- if cluster.engine == "virt" %}
  17. {%- for node_name, node in cluster.node.iteritems() %}
  18. {%- if node.name is defined %}
  19. {%- set node_name = node.name %}
  20. {%- endif %}
  21. {%- if node.provider == grains.id %}
  22. {%- set size = control.size.get(node.size) %}
  23. salt_control_virt_{{ cluster_name }}_{{ node_name }}:
  24. module.run:
  25. - name: virtng.init
  26. - m_name: {{ node_name }}.{{ cluster.domain }}
  27. - cpu: {{ size.cpu }}
  28. - mem: {{ size.ram }}
  29. - image: {{ node.image }}
  30. - start: True
  31. - disk: {{ size.disk_profile }}
  32. - nic: {{ size.net_profile }}
  33. - kwargs:
  34. seed: True
  35. serial_type: pty
  36. console: True
  37. - unless: virsh list --all --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$"
  38. #salt_control_seed_{{ cluster_name }}_{{ node_name }}:
  39. # module.run:
  40. # - name: seed.apply
  41. # - path: /srv/salt-images/{{ node_name }}.{{ cluster.domain }}/system.qcow2
  42. # - id_: {{ node_name }}.{{ cluster.domain }}
  43. # - unless: virsh list | grep {{ node_name }}.{{ cluster.domain }}
  44. {%- if node.get("autostart", True) %}
  45. salt_virt_autostart_{{ cluster_name }}_{{ node_name }}:
  46. module.run:
  47. - name: virt.set_autostart
  48. - vm_: {{ node_name }}.{{ cluster.domain }}
  49. - state: true
  50. - unless: virsh list --autostart --name| grep -E "^{{ node_name }}.{{ cluster.domain }}$"
  51. {%- endif %}
  52. {%- endif %}
  53. {%- endfor %}
  54. {%- endif %}
  55. {%- endfor %}
  56. {%- endif %}