Commit graph

24 commits

Author SHA1 Message Date
Daniel
bbe3a29d25
Merge pull request #246 from stasjok/use-jinja-comments-in-jinja
style(libsaltcli): fix comments to jinja comments
2022-02-17 07:58:10 +00:00
Daniel
506ebdf67e
Merge pull request #245 from stasjok/change-F-to-Y
refactor(libmatchers): match default type with docs
2022-02-17 07:57:31 +00:00
Stanislav Asunkin
e1735f47f8 style(libsaltcli): fix comments to jinja comments 2022-02-16 09:14:22 +03:00
Stanislav Asunkin
8f847bebfd refactor(libmatchers): match default type with docs 2022-02-15 19:51:27 +03:00
Stanislav Asunkin
bb3a7ea0b2 fix(libmapstack): allow mapping by booleans and numbers 2022-02-15 18:35:15 +03:00
Daniel Dehennin
6eb2073d02
fix(libsaltcli+libmatchers): ensure Salt client API detection [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/411
2022-02-04 22:01:30 +00:00
Imran Iqbal
bf9a9bd204
refactor(map.jinja): standardise v5 structure [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/382
2021-10-26 12:11:39 +01:00
Daniel Dehennin
42e19322c9 feat(map): update to v5 map.jinja
The v5 `map.jinja` is a generic and configurable system to load
configuration values, exposed as the `mapdata` variable, from
different places:

- YAML files and templates from the fileserver for non-secret data
- pillars or SDB are preferred for secret data
- grains or `config.get`

The `map.jinja` optional sources are configured with compound targeting like
syntax `[<TYPE>[:<OPTION>[:<DELIMITER>]]@]<KEY>` with the following
default ordered sources:

- `Y:G@osarch`: YAML file and Jinja template named after `osarch` grain
- `Y:G@os_family`: YAML file and Jinja template named after `os_family` grain
- `Y:G@os` YAML file and Jinja template named after `os` grain
- `Y:G@osfinger` YAML file and Jinja template named after `osfinger` grain
- `C@{{ tplroot ~ ':lookup' }}`: dict retrieved with `salt["config.get"]`
- `C@{{ tplroot }}`: dict retrieved with `salt["config.get"]`
- `Y:G@id`: YAML file and Jinja template named after `osarch` grain

This is done by two new libraries:

- `libmatchers.jinja` provides the `parse_matchers` macro to parse
  strings looking like compound matchers, for example `Y:G@osarch`

- `libmapstack.jinja` provides the `mapstack` macro to load
  configuration from different sources described by matchers

Post-processing of `mapdata` variable can be done in a `parameters/post-map.jinja`.

The v5 `map.jinja` is documented in `docs/map.jinja.rst`.

BREAKING CHANGE: `map.jinja` now exports a generic `mapdata` variable

BREAKING CHANGE: The per grain parameter values are now under `TEMPLATE/parameters/`
2021-02-16 11:10:09 +01:00
Daniel Dehennin
bcb8e29b68
fix(_mapdata): ensure map data is directly under values
* Semi-automated using https://github.com/myii/ssf-formula/pull/287
2021-01-14 20:35:51 +00:00
Imran Iqbal
f8e8fcb29e
refactor(map): use top-level values: key in map.jinja dumps
* Semi-automated using https://github.com/myii/ssf-formula/pull/284
2020-12-23 18:44:04 +00:00
Imran Iqbal
4c8cf32db1
test(map): standardise map.jinja verification
* Automated using https://github.com/myii/ssf-formula/pull/281
2020-12-22 00:43:16 +00:00
Imran Iqbal
4be96d3618
Merge pull request #207 from dafyddj/fix/convert-dash-underscore
fix(convert-formulas.sh): add -_ to allowed chars in formula name
2020-10-31 19:08:55 +00:00
Dafydd Jones
a999fee214 fix(convert-formula.sh): add -_ to allowed chars in formula name 2020-10-14 22:42:18 +01:00
Imran Iqbal
4c2f4ede02
feat: add Gentoo support
Make use of the new pre-salted images:

* https://gitlab.com/saltstack-formulas/infrastructure/salt-image-builder/-/merge_requests/55
2020-10-12 07:33:44 +01:00
Daniel Dehennin
fc90075dd9 feat(map): generate a YAML file to validate map.jinja
We provide a new `_mapdata` state which generate a
`/tmp/salt_mapdata_dump.yaml` to be validated by `Inspec`.
2020-09-03 16:29:10 +02:00
Imran Iqbal
55bc69a2b1
style(libtofs.jinja): use Black-inspired Jinja formatting [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/237
2020-07-20 17:37:39 +01:00
Imran Iqbal
f0e7192fb5 fix(libsaltcli): update salt-ssh detection for enable_ssh_minions
* Automated using https://github.com/myii/ssf-formula/pull/161
2020-04-19 17:51:15 +01:00
Imran Iqbal
3a1fc35a13
fix(running.sls): use watch not require to ensure service restart
* Service isn't restarted if the config file changes
* Made aware of this in the `keepalived-formula`, which was updated to
  this `template-formula` structure
  - https://github.com/saltstack-formulas/keepalived-formula/issues/37
  - https://github.com/saltstack-formulas/keepalived-formula/pull/41
* May need to reconsider: should we really be watching the whole `sls`
  rather than explictly watching each state?
2020-04-07 14:13:43 +01:00
Imran Iqbal
69b632fbe6 refactor(libsaltcli): use the opts dict throughout [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/139
2020-03-30 00:20:56 +01:00
Imran Iqbal
a6487b5cf9
chore(libsaltcli): add lib to check type of Salt command being used
* To distinguish between:
  - `salt-minion`
  - `salt-call`
  - `salt-ssh`
* Invoked like `map.jinja`:
  - `{%- from tplroot ~ "/libsaltcli.jinja" import cli with context %}`
* Based upon work done in PRs: #102, #114 & #115
* Finalised from https://github.com/saltstack-formulas/libvirt-formula/pull/71
* Required by #186
2020-03-25 15:21:22 +00:00
Imran Iqbal
241646fe96 fix(libtofs): “files_switch” mess up the variable exported by “map.jinja” [skip ci]
* Checked using https://github.com/myii/ssf-formula/pull/131
2020-02-14 19:11:55 +00:00
Daniel Dehennin
ab4ce751a4 fix(libtofs): “files_switch” mess up the variable defined by “map.jinja”
- “map.jinja” export a variable name as “<tplroot>”
- import of “libtofs.jinja” is done with context and has access to
  “<tplroot>” variable
- in “files_switch”, appending the empty string to the “fsl” variable
  modify globally “<tplroot>['tofs']['files_switch']”

* TEMPLATE/libtofs.jinja: do not use inplace “append” to avoid side effect.
2020-02-14 08:57:31 +01:00
Imran Iqbal
4be16ca4be
fix: fix CentOS Linux-7 and add os details from current CI setup 2020-01-27 09:26:44 +00:00
Dafydd Jones
2e8ded6565 refactor: improve reusability using an unique keyword TEMPLATE
BREAKING CHANGE: changed all state names and ids
2019-12-04 23:47:41 +00:00