This repository has been archived by the owner on Sep 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
services.sls
69 lines (61 loc) · 1.79 KB
/
services.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{% for host, hostinfo in salt['pillar.get']('machines', {}).iteritems() %}
{% if hostinfo.has_key('services') %}
{% if grains['os_family'] == 'RedHat' %}
{% set preset_servicenames = {
'apache': "httpd",
'cron': "crond",
'dhcp': "dhcpd",
'dns': "named",
'ftp': "proftpd",
'mail': "postfix",
'mysql': "mysqld",
'nfs': "nfs",
'sge': "sgemaster." + grains['host'],
'ssh': "sshd" } %}
{% elif grains['os_family'] == 'Debian' %}
{% set preset_servicenames = {
'apache': "apache2",
'cron': "cron",
'dhcp': "isc-dhcp-server",
'dns': "bind9",
'ftp': "proftpd",
'mail': "postfix",
'mysql': "mysql",
'nfs': "nfs-kernel-server",
'sge': "sgemaster." + grains['host'],
'ssh': "ssh" } %}
## 'sge': "gridengine-master" } %}
{% endif %}
{% if hostinfo.has_key('SaltHostname') %}
{% if grains['id'] == hostinfo['SaltHostname'] %}
{% for service in hostinfo['services'] %}
{% if preset_servicenames.has_key(service) %}
{% if service == "sge" %}
{{ preset_servicenames[service] }}__{{ grains['id'] }}:
cmd.run:
- name: pgrep sge_qmaster
{% else %}
{{ preset_servicenames[service] }}__{{ grains['id'] }}:
module.run:
- name: customservice.status
- m_name: {{ preset_servicenames[service] }}
#{{ preset_servicenames[service] }}__{{ grains['id'] }}__static_state:
# service.running:
# - name: {{ preset_servicenames[service] }}
# - enable: True
{% endif %}
{% else %}
{{ service }}__{{ grains['id'] }}:
module.run:
- name: customservice.status
- m_name: {{ service }}
#{{ service }}__{{ grains['id'] }}__static_state:
# service.running:
# - name: {{ service }}
# - enable: True
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}