-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathsalt.sls
More file actions
188 lines (159 loc) · 3.93 KB
/
salt.sls
File metadata and controls
188 lines (159 loc) · 3.93 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{% if grains["oscodename"] == "focal" %}
python-requests:
pkg.latest:
- name: python3-requests
python-msgpack:
pkg.latest:
- name: python3-msgpack
{% elif grains["oscodename"] in ["jammy", "noble"] %}
python-requests:
pkg.latest:
- name: python3-requests
python-msgpack:
pkg.latest:
- name: python3-msgpack
{% else %}
python-requests:
pkg.latest
python-msgpack:
pkg.latest
{% endif %}
python3-pip:
pkg.latest
{% if grains["os"] == "Ubuntu" %}
{# TODO: can be removed after anytime after 2024-07-16 #}
remove_old_salt_repo:
file.absent:
- name: /etc/apt/sources.list.d/saltstack.list
{% if grains["oscodename"] in ["focal", "jammy", "noble"] %}
salt-pin-config:
file.managed:
- name: /etc/apt/preferences.d/salt-pin-1001
- contents: |
Package: salt-*
Pin: version 3006.*
Pin-Priority: 1001
- user: root
- group: root
- mode: "0644"
salt-repo-key:
file.managed:
- name: /etc/apt/keyrings/salt-archive-keyring.pgp
- source: https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public
- mode: '0644'
- skip_verify: True
- makedirs: True
salt-repo:
pkgrepo.managed:
- name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.pgp arch={{ grains["osarch"] }}] https://packages.broadcom.com/artifactory/saltproject-deb/ stable main
- aptkey: False
- file: /etc/apt/sources.list.d/salt.list
- require:
- file: salt-repo-key
{% endif %}
{% endif %}
{% if salt["match.compound"](pillar["roles"]["salt-master"]["pattern"]) %}
include:
- tls.lego
salt-master-pkg:
pkg.latest:
- name: salt-master
/etc/salt/master.d/roles.conf:
file.managed:
- source: salt://base/config/salt-roles.conf.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
- order: last
salt-master:
service.running:
- enable: True
- restart: True
- order: last
- watch:
- file: /etc/salt/master.d/roles.conf
/etc/lego/.well-known/acme-challenge/sentinel:
file.managed:
- contents: "OK"
- user: root
- group: root
- mode: "0644"
- require:
- sls: tls.lego
/etc/nginx/sites.d/letsencrypt-well-known.conf:
file.managed:
- source: salt://base/config/letsencrypt-well-known-nginx.conf
- user: root
- group: root
- mode: "0644"
- require:
- file: /etc/nginx/sites.d/
/etc/consul.d/service-letsencrypt-well-known.json:
file.managed:
- source: salt://consul/etc/service.jinja
- template: jinja
- context:
name: letsencrypt-well-known
port: 9000
- user: root
- group: root
- mode: "0644"
- require:
- pkg: consul-pkgs
/srv/public:
file.directory:
- user: root
- group: root
- mode: "0755"
/srv/public/psf_known_hosts:
file.managed:
- source: salt://base/config/known_hosts.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
/srv/public/salt-server-list.rst:
file.managed:
- source: salt://base/config/salt-server-list.rst.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
/etc/nginx/sites.d/publish-files.conf:
file.managed:
- source: salt://base/config/publish-files-nginx.conf
- user: root
- group: root
- mode: "0644"
- require:
- file: /etc/nginx/sites.d/
- file: /srv/public
/etc/consul.d/service-publish-files.json:
file.managed:
- source: salt://consul/etc/service.jinja
- template: jinja
- context:
name: publish-files
port: 9001
- user: root
- group: root
- mode: "0644"
- require:
- pkg: consul-pkgs
{% endif %}
salt-minion-pkg:
pkg.latest:
- name: salt-minion
/etc/salt/minion.d/mine.conf:
file.managed:
- contents: "mine_interval: 5"
- user: root
- group: root
- mode: "0640"
salt-minion:
service.running:
- enable: True
- restart: True
- watch:
- file: /etc/salt/minion.d/mine.conf