17750: Centos 7 needs rvm for api and workbench
[arvados-formula.git] / arvados / dispatcher / service / file.sls
1 # -*- coding: utf-8 -*-
2 # vim: ft=sls
3
4 {#- Get the `tplroot` from `tpldir` #}
5 {%- set tplroot = tpldir.split('/')[0] %}
6 {%- set sls_config_file = tplroot ~ '.config.file' %}
7 {%- from tplroot ~ "/map.jinja" import arvados with context %}
8 {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
9
10 include:
11   - ..package
12   - {{ sls_config_file }}
13   - .running
14
15 {%- if arvados.dispatcher.pkg.name == 'crunch-dispatch-local' %}
16 arvados-dispatcher-service-file-file-managed-crunch-run-sh:
17   file.managed:
18     - name: /usr/local/bin/crunch-run.sh
19     - source: {{ files_switch(['crunch-run-sh.tmpl'],
20                               lookup='arvados-dispatcher-service-file-file-managed-crunch-run-sh',
21                               use_subpath=True
22                  )
23               }}
24     - mode: '0755'
25     - user: root
26     - group: root
27     - makedirs: True
28     - context:
29         arvados: {{ arvados | json }}
30     - require:
31       - pkg: arvados-dispatcher-package-install-pkg-installed
32
33 arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-credentials:
34   file.managed:
35     - name: /etc/arvados/crunch-dispatch-local-credentials
36     - source: {{ files_switch(['crunch-dispatch-local-credentials.tmpl'],
37                               lookup='arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-credentials',
38                               use_subpath=True
39                  )
40               }}
41     - mode: '0640'
42     - user: root
43     - group: root
44     - makedirs: True
45     - template: jinja
46     - context:
47         arvados: {{ arvados | json }}
48     - require:
49       - pkg: arvados-dispatcher-package-install-pkg-installed
50
51 arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service:
52   file.managed:
53     - name: /etc/systemd/system/crunch-dispatch-local.service
54     - source: {{ files_switch(['crunch-dispatch-local-service.tmpl'],
55                               lookup='arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service',
56                               use_subpath=True
57                  )
58               }}
59     - mode: '0644'
60     - user: root
61     - group: root
62     - makedirs: True
63     - template: jinja
64     - context:
65         arvados: {{ arvados | json }}
66     - require:
67       - file: arvados-dispatcher-service-file-file-managed-crunch-run-sh
68       - file: arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-credentials
69       - pkg: arvados-dispatcher-package-install-pkg-installed
70   cmd.run:
71     - name: systemctl daemon-reload
72     - require_in:
73       - service: arvados-dispatcher-service-running-service-running
74     - require:
75       - file: arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service
76     - onchanges:
77       - file: arvados-dispatcher-service-file-file-managed-crunch-dispatch-local-service
78 {%- endif %}