Saltstack Official Apt-Cacher Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

76 lines
2.3KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {#- Get the `tplroot` from `tpldir` #}
  4. {%- set tplroot = tpldir.split('/')[0] %}
  5. {%- set sls_package_install = tplroot ~ '.ng.server.package.install' %}
  6. {%- from tplroot ~ "/ng/map.jinja" import apt_cacher_ng with context %}
  7. {%- from tplroot ~ "/ng/libtofs.jinja" import files_switch with context %}
  8. include:
  9. - {{ sls_package_install }}
  10. apt-cacher/ng/server/config/group/create:
  11. group.present:
  12. - name: {{ apt_cacher_ng.group }}
  13. apt-cacher/ng/server/config/user/create:
  14. user.present:
  15. - name: {{ apt_cacher_ng.user }}
  16. {%- if grains['os_family'] == 'FreeBSD' %}
  17. apt-cacher/ng/server/config/user/sysrc:
  18. sysrc.managed:
  19. - name: apt_cacher_ng_user
  20. - value: "{{ apt_cacher_ng.user }}"
  21. {%- endif %}
  22. apt-cacher/ng/server/config/file:
  23. file.managed:
  24. - name: {{ apt_cacher_ng.server_config }}
  25. - user: root
  26. - group: {{ apt_cacher_ng.root_group }}
  27. - mode: '644'
  28. - source: {{ files_switch(['server.conf'],
  29. lookup='apt-cacher/ng/server/config/file',
  30. use_subpath=True
  31. )
  32. }}
  33. - template: jinja
  34. - require:
  35. - sls: {{ sls_package_install }}
  36. - context:
  37. apt_cacher_ng: {{ apt_cacher_ng | json }}
  38. apt-cacher/ng/server/config/server_cache_dir:
  39. file.directory:
  40. - name: {{ apt_cacher_ng.server_cache_dir }}
  41. - makedirs: true
  42. - user: {{ apt_cacher_ng.user }}
  43. - group: {{ apt_cacher_ng.group }}
  44. - mode: '2755'
  45. apt-cacher/ng/server/config/server_log_dir:
  46. file.directory:
  47. - name: {{ apt_cacher_ng.server_log_dir }}
  48. - makedirs: true
  49. - user: {{ apt_cacher_ng.user }}
  50. - group: {{ apt_cacher_ng.group }}
  51. - mode: '2755'
  52. apt-cacher/ng/server/config/credentials:
  53. file.managed:
  54. - name: {{ apt_cacher_ng.credentials }}
  55. - user: {{ apt_cacher_ng.user }}
  56. - group: {{ apt_cacher_ng.group }}
  57. - mode: '600'
  58. - source: {{ files_switch(['security.conf'],
  59. lookup='apt-cacher/ng/server/config/credentials',
  60. use_subpath=True
  61. )
  62. }}
  63. - template: jinja
  64. - context:
  65. admin_account: {{ apt_cacher_ng.get('admin_account', False) }}
  66. admin_passwd: {{ apt_cacher_ng.get('admin_passwd', False) }}