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.

58 lines
1.3KB

  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. - requirements: salt://home_assistant/files/requirements.txt
  9. - require:
  10. - pkg: home_assistant_packages
  11. - user: home_assistant
  12. home_assistant_user:
  13. user.present:
  14. - name: home_assistant
  15. - system: true
  16. - home: {{ server.dir.base }}
  17. - require:
  18. - virtualenv: {{ server.dir.base }}
  19. home_assistant_dir:
  20. file.directory:
  21. - names:
  22. - /etc/home_assistant
  23. - /var/log/home_assistant
  24. - mode: 700
  25. - makedirs: true
  26. - user: home_assistant
  27. - require:
  28. - virtualenv: {{ server.dir.base }}
  29. home_assistant_config:
  30. file.managed:
  31. - name: /etc/home_assistant/configuration.yaml
  32. - source: salt://home_assistant/files/configuration.yaml
  33. - template: jinja
  34. - user: home_assistant
  35. - mode: 600
  36. - require:
  37. - file: home_assistant_dir
  38. {%- if server.known_device is defined %}
  39. home_assistant_know_devices:
  40. file.managed:
  41. - name: /etc/home_assistant/known_devices.yaml
  42. - source: salt://home_assistant/files/known_devices.yaml
  43. - template: jinja
  44. - user: home_assistant
  45. - mode: 600
  46. - require:
  47. - file: home_assistant_dir
  48. {%- endif %}
  49. {%- endif %}