Skip to content

Commit 0638413

Browse files
committed
docs(tofs): apply language formatting to source code blocks
1 parent 2c5dc21 commit 0638413

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

TOFS_pattern.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Let's work with the NTP example. A basic formula that follows the [design guidel
7070

7171
In order to use it, let's assume a [masterless configuration](http://docs.saltstack.com/en/latest/topics/tutorials/quickstart.html) and this relevant section of `/etc/salt/minion`:
7272

73-
```
73+
```yaml
7474
pillar_roots:
7575
base:
7676
- /srv/saltstack/pillar
@@ -81,7 +81,7 @@ file_roots:
8181
- /srv/saltstack/salt-formulas/ntp-saltstack-formula
8282
```
8383
84-
```
84+
```jinja
8585
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/map.jinja
8686
{%- set ntp = salt['grains.filter_by']({
8787
'default': {
@@ -94,7 +94,7 @@ file_roots:
9494

9595
In `init.sls` we have the minimal states required to have NTP configured. In many cases `init.sls` is almost equivalent to an `apt-get install` or a `yum install` of the package.
9696

97-
```
97+
```sls
9898
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/init.sls
9999
{%- from 'ntp/map.jinja' import ntp with context %}
100100
@@ -112,7 +112,7 @@ Enable and start NTP:
112112

113113
In `conf.sls` we have the configuration states. In most cases, that is just managing configuration file templates and making them to be watched by the service.
114114

115-
```
115+
```sls
116116
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
117117
include:
118118
- ntp
@@ -132,7 +132,7 @@ Configure NTP:
132132

133133
Under `files/default`, there is a structure that mimics the one in the minion in order to avoid clashes and confusion on where to put the needed templates. There you can find a mostly standard template for the configuration file.
134134

135-
```
135+
```jinja
136136
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/default/etc/ntp.conf.jinja
137137
# Managed by saltstack
138138
# Edit pillars or override this template in saltstack if you need customization
@@ -163,7 +163,7 @@ With all this, it is easy to install and configure a simple NTP server by just r
163163

164164
Alternatively, you can define a highstate in `/srv/saltstack/salt/top.sls` and run `salt-call state.highstate`.
165165

166-
```
166+
```sls
167167
## /srv/saltstack/salt/top.sls
168168
base:
169169
'*':
@@ -172,15 +172,15 @@ base:
172172

173173
**Customizing the formula just with pillar data**, we have the option to define the NTP servers.
174174

175-
```
175+
```sls
176176
## /srv/saltstack/pillar/top.sls
177177
base:
178178
'*':
179179
- ntp
180180
```
181181

182182

183-
```
183+
```sls
184184
## /srv/saltstack/pillar/ntp.sls
185185
ntp:
186186
servers:
@@ -195,7 +195,7 @@ ntp:
195195

196196
If the customization based on pillar data is not enough, we can override the template by creating a new one in `/srv/saltstack/salt/ntp/files/default/etc/ntp.conf.jinja`
197197

198-
```
198+
```jinja
199199
## /srv/saltstack/salt/ntp/files/default/etc/ntp.conf.jinja
200200
# Managed by saltstack
201201
# Edit pillars or override this template in saltstack if you need customization
@@ -234,7 +234,7 @@ If we decide that we want `os_family` as switch, then we could provide the formu
234234

235235
To make this work we need a `conf.sls` state file that takes a list of possible files as the configuration template.
236236

237-
```
237+
```sls
238238
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
239239
include:
240240
- ntp
@@ -256,7 +256,7 @@ Configure NTP:
256256

257257
If we want to cover the possibility of a special template for a minion identified by `node01` then we could have a specific template in `/srv/saltstack/salt/ntp/files/node01/etc/ntp.conf.jinja`.
258258

259-
```
259+
```jinja
260260
## /srv/saltstack/salt/ntp/files/node01/etc/ntp.conf.jinja
261261
# Managed by saltstack
262262
# Edit pillars or override this template in saltstack if you need customization
@@ -267,7 +267,7 @@ If we want to cover the possibility of a special template for a minion identifie
267267

268268
To make this work we could write a specially crafted `conf.sls`.
269269

270-
```
270+
```sls
271271
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
272272
include:
273273
- ntp
@@ -292,7 +292,7 @@ Configure NTP:
292292

293293
We can simplify the `conf.sls` with the new `files_switch` macro to use in the `source` parameter for the `file.managed` state.
294294

295-
```
295+
```sls
296296
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/conf.sls
297297
include:
298298
- ntp
@@ -322,7 +322,7 @@ Configure NTP:
322322

323323
In `macros.jinja`, we define this new macro `files_switch`.
324324

325-
```
325+
```jinja
326326
## /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/macros.jinja
327327
{%- macro files_switch(files,
328328
default_files_switch=['id', 'os_family'],

0 commit comments

Comments
 (0)