New version of salt-formula from Saltstack
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

proxy.sls 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {%- from "salt/map.jinja" import proxy_minion with context %}
  2. {%- set napalm = false %}
  3. {%- for proxy_name, proxy_device in proxy_minion.get('device', {}).iteritems() %}
  4. {%- if proxy_device.engine == 'napalm' %}
  5. {%- set napalm = true %}
  6. {%- endif %}
  7. {%- endfor %}
  8. /etc/systemd/system/salt-proxy@.service:
  9. file.managed:
  10. - source: salt://salt/files/salt-proxy.service
  11. - template: jinja
  12. /etc/salt/proxy:
  13. file.managed:
  14. - source: salt://salt/files/proxy.conf
  15. - template: jinja
  16. - defaults:
  17. napalm: {{ napalm }}
  18. proxy: {{ proxy|yaml }}
  19. {%- if napalm %}
  20. network_proxy_packages:
  21. pkg.installed:
  22. - names: {{ proxy.napalm_pkgs }}
  23. napalm:
  24. pip.installed:
  25. - name: {{ proxy.napalm_pip_pkgs}}
  26. - require:
  27. - pkg: python-pip
  28. {%- endif %}
  29. {%- for proxy_name, proxy_device in proxy_minion.get('device', {}).iteritems() %}
  30. salt_proxy_{{ proxy_name }}_service:
  31. service.running:
  32. - enable: true
  33. - name: salt-proxy@{{ proxy_name }}
  34. - watch:
  35. - file: /etc/salt/proxy
  36. - file: /etc/systemd/system/salt-proxy@.service
  37. {%- endfor %}