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.

43 lines
974B

  1. {%- from "linux/map.jinja" import system with context %}
  2. linux_sysfs_package:
  3. pkg.installed:
  4. - pkgs:
  5. - sysfsutils
  6. - refresh: true
  7. /etc/sysfs.d:
  8. file.directory:
  9. - require:
  10. - pkg: linux_sysfs_package
  11. {%- for name, sysfs in system.get('sysfs', {}).items() %}
  12. /etc/sysfs.d/{{ name }}.conf:
  13. file.managed:
  14. - source: salt://linux/files/sysfs.conf
  15. - template: jinja
  16. - user: root
  17. - group: root
  18. - mode: 0644
  19. - defaults:
  20. name: {{ name }}
  21. sysfs: {{ sysfs|yaml }}
  22. - require:
  23. - file: /etc/sysfs.d
  24. {%- for key, value in sysfs.items() %}
  25. {%- if key not in ["mode", "owner"] %}
  26. {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
  27. {#- Sysfs cannot be set in docker, LXC, etc. #}
  28. linux_sysfs_write_{{ name }}_{{ key }}:
  29. module.run:
  30. - name: sysfs.write
  31. - key: {{ key }}
  32. - value: {{ value }}
  33. {%- endif %}
  34. {%- endif %}
  35. {%- endfor %}
  36. {%- endfor %}