Saltstack Official Home Assistant 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.

server.sls 1.3KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {%- from "home_assistant/map.jinja" import server with context %}
  2. {%- if server.enabled %}
  3. home_assistant_packages:
  4. pkg.installed:
  5. - names: {{ server.pkgs }}
  6. {{ server.dir.base }}:
  7. virtualenv.manage:
  8. - system_site_packages: True
  9. - requirements: salt://home_assistant/files/requirements.txt
  10. - python: /usr/bin/python3
  11. - require:
  12. - pkg: home_assistant_packages
  13. home_assistant_user:
  14. user.present:
  15. - name: home_assistant
  16. - system: true
  17. - home: {{ server.dir.base }}
  18. - require:
  19. - virtualenv: {{ server.dir.base }}
  20. home_assistant_dir:
  21. file.directory:
  22. - names:
  23. - /etc/home_assistant
  24. - /var/log/home_assistant
  25. - mode: 700
  26. - makedirs: true
  27. - user: home_assistant
  28. - require:
  29. - virtualenv: {{ server.dir.base }}
  30. home_assistant_config:
  31. file.managed:
  32. - name: /etc/home_assistant/configuration.yaml
  33. - source: salt://home_assistant/files/configuration.yaml
  34. - template: jinja
  35. - user: home_assistant
  36. - mode: 600
  37. - require:
  38. - file: home_assistant_dir
  39. {%- if server.known_device is defined %}
  40. home_assistant_know_devices:
  41. file.managed:
  42. - name: /etc/home_assistant/known_devices.yaml
  43. - source: salt://home_assistant/files/known_devices.yaml
  44. - template: jinja
  45. - user: home_assistant
  46. - mode: 600
  47. - require:
  48. - file: home_assistant_dir
  49. {%- endif %}
  50. {%- endif %}