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.

60 lines
1.4KB

  1. {% from "salt/map.jinja" import control with context %}
  2. {%- if control.enabled and control.virt_enabled is defined %}
  3. salt_control_virt_packages:
  4. pkg.installed:
  5. - names: {{ control.virt_pkgs }}
  6. {#
  7. {%- for package in control.virt_pips %}
  8. {{ package }}:
  9. pip.installed:
  10. - require:
  11. - pkg: salt_control_virt_packages
  12. {%- endfor %}
  13. #}
  14. {%- for cluster_name, cluster in control.cluster.iteritems() %}
  15. {%- if cluster.engine == "virt" %}
  16. {%- for node_name, node in cluster.node.iteritems() %}
  17. {%- if node.provider == grains.id %}
  18. {%- set size = control.size.get(node.size) %}
  19. salt_control_virt_{{ cluster_name }}_{{ node_name }}:
  20. module.run:
  21. - name: virt.init
  22. - m_name: {{ node_name }}.{{ cluster.domain }}
  23. - cpu: {{ size.cpu }}
  24. - mem: {{ size.ram }}
  25. - image: salt://{{ node.image }}
  26. - start: True
  27. - disk: {{ node.disk_profile }}
  28. - nic: {{ node.net_profile }}
  29. - kwargs:
  30. seed: True
  31. serial_type: pty
  32. console: True
  33. - unless: virsh list --all | grep {{ node_name }}.{{ cluster.domain }}
  34. #salt_control_seed_{{ cluster_name }}_{{ node_name }}:
  35. # module.run:
  36. # - name: seed.apply
  37. # - path: /srv/salt-images/{{ node_name }}.{{ cluster.domain }}/system.qcow2
  38. # - id_: {{ node_name }}.{{ cluster.domain }}
  39. # - unless: virsh list | grep {{ node_name }}.{{ cluster.domain }}
  40. {%- endif %}
  41. {%- endfor %}
  42. {%- endif %}
  43. {%- endfor %}
  44. {%- endif %}