Saltstack Official Linux Formula
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.

44 lines
1.1KB

  1. {%- from "linux/map.jinja" import network with context %}
  2. {%- if network.get('openvswitch', {}).get('enabled', False) %}
  3. openvswitch_pkgs:
  4. pkg.installed:
  5. - pkgs: {{ network.ovs_pkgs | json }}
  6. /etc/default/openvswitch-switch:
  7. file.managed:
  8. - source: salt://linux/files/openvswitch-switch.default
  9. - template: jinja
  10. - require:
  11. - pkg: openvswitch_pkgs
  12. /etc/systemd/system/openvswitch-switch.service:
  13. file.managed:
  14. - source: salt://linux/files/openvswitch-switch.systemd
  15. - template: jinja
  16. - require:
  17. - pkg: openvswitch_pkgs
  18. openvswitch_sytemctl_reload:
  19. module.run:
  20. {%- if 'module.run' in salt['config.get']('use_superseded', default=[]) %}
  21. - service.systemctl_reload: []
  22. {%- else %}
  23. - name: service.systemctl_reload
  24. {%- endif %}
  25. - onchanges:
  26. - file: /etc/systemd/system/openvswitch-switch.service
  27. openvswitch_switch_service:
  28. service.running:
  29. - name: openvswitch-switch
  30. - enable: true
  31. {%- if grains.get('noservices') %}
  32. - onlyif: /bin/false
  33. {%- endif %}
  34. - watch:
  35. - file: /etc/default/openvswitch-switch
  36. {%- endif %}