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.

53 lines
1.0KB

  1. {%- from "salt/map.jinja" import proxy with context %}
  2. {%- set napalm = false %}
  3. {%- for proxy_name, proxy_device in proxy.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.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 %}