New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 년 전
8 년 전
8 년 전
8 년 전
8 년 전
8 년 전
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. {#
  9. {%- for package in control.virt_pips %}
  10. {{ package }}:
  11. pip.installed:
  12. - require:
  13. - pkg: salt_control_virt_packages
  14. {%- endfor %}
  15. #}
  16. /etc/salt/minion.d/_virt.conf:
  17. file.managed:
  18. - source: salt://salt/files/_virt.conf
  19. - user: root
  20. - group: root
  21. - template: jinja
  22. - require:
  23. - pkg: salt_control_virt_packages
  24. - watch_in:
  25. - service: salt_minion_service
  26. {%- for cluster_name, cluster in control.cluster.iteritems() %}
  27. {%- if cluster.engine == "virt" %}
  28. {%- for node_name, node in cluster.node.iteritems() %}
  29. {%- if node.provider == grains.id %}
  30. {%- set size = control.size.get(node.size) %}
  31. salt_control_virt_{{ cluster_name }}_{{ node_name }}:
  32. module.run:
  33. - name: virtng.init
  34. - m_name: {{ node_name }}.{{ cluster.domain }}
  35. - cpu: {{ size.cpu }}
  36. - mem: {{ size.ram }}
  37. - image: {{ node.image }}
  38. - start: True
  39. - disk: {{ size.disk_profile }}
  40. - nic: {{ size.net_profile }}
  41. - kwargs:
  42. seed: True
  43. serial_type: pty
  44. console: True
  45. - unless: virsh list --all | grep {{ node_name }}.{{ cluster.domain }}
  46. #salt_control_seed_{{ cluster_name }}_{{ node_name }}:
  47. # module.run:
  48. # - name: seed.apply
  49. # - path: /srv/salt-images/{{ node_name }}.{{ cluster.domain }}/system.qcow2
  50. # - id_: {{ node_name }}.{{ cluster.domain }}
  51. # - unless: virsh list | grep {{ node_name }}.{{ cluster.domain }}
  52. {%- endif %}
  53. {%- endfor %}
  54. {%- endif %}
  55. {%- endfor %}
  56. {%- endif %}