Advertisement
Guest User

Untitled

a guest
Dec 6th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. from .sls file:
  2. {% for hostname in pillar %}
  3. {% if hostname not in ('alpha', 'beta', 'gamma', 'master') %}
  4. # set libvirt_uuid = pillar[hostname]['libvirt_uuid']
  5. /etc/libvirt/qemu/{{ hostname }}.xml:
  6. file.managed:
  7. - template: jinja
  8. - user: root
  9. - group: root
  10. - mode: 600
  11. - source: salt://files/etc/libvirt/qemu/machine.xml
  12. - context:
  13. cpu_count: {{ pillar[hostname]['cpu_count'] }}
  14. hostname: {{ hostname }}
  15. image_format: {% if hostname in ('bloodhound1', 'placeholder') %}raw{% else %}qcow2{% endif %}
  16. libvirt_uuid: {{ pillar[hostname]['libvirt_uuid'] }}
  17. {% if pillar[hostname]['eth0_network'] == '10.0.0.0/24' %}
  18. master: '10.0.0.1'
  19. {% else %}
  20. master: '127.0.0.1'
  21. {% endif %}
  22. memory: {{ (pillar[hostname]['memory']*1024*1024)|int }}
  23. number: {% if pillar[hostname]['number'] < 10 %} '0' + number|string {% else %} number {% endif %}
  24. {% endif %}
  25. {% endfor %}
  26.  
  27.  
  28.  
  29. alternative for master:
  30. master: {% if pillar[hostname]['eth0_network'] == '10.0.0.0/24' %} '10.0.0.1' {% else %} '127.0.0.1' {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement