Commit Graph

38 Commits

Author SHA1 Message Date
Daniel Dehennin
925c86ea69 refactor(map): compound matchers like parsing with libmatchers 2021-01-11 17:41:20 +01:00
Daniel Dehennin
1be0d8725a feat(map): use targeting like syntax for configuration
The `config_get_lookup` and `config_get` sources lack flexibility.

It's not easy to query several pillars and/or grains keys with the
actual system. And the query method is forced to `config.get` without
being configurable by the user.

We define a mechanism to select `map.jinja` sources with similar
notation as the salt targeting system.

The `map.jinja` file uses several sources where to lookup parameter
values. The list of sources can be modified by two files:

1. a global salt://parameters/map_jinja.yaml
2. a per formula salt://{{ tplroot }}/parameters/map_jinja.yaml.

Each source definition has the form `<TYPE>:<OPTION>@<KEY>` where
`<TYPE>` can be one of:

- `Y` to load values from YAML files, this is the default when no type
  is defined
- `C` to lookup values with `config.get`
- `G` to lookup values with `grains.get`
- `I` to lookup values with `pillar.get`

The YAML type option can define the query method to lookup the key
value to build the file name:

- `C` to query with `config.get`, this is the default when to query
  method is defined
- `G` to query with `grains.get`
- `I` to query with `pillar.get`

The `C`, `G` or `I` types can define the `SUB` option to store values
in the sub key `mapdata.<key>` instead of directly in `mapdata`.

Finally, the `<KEY>` describe what to lookup to either build the YAML
filename or gather values using one of the query method.

BREAKING CHANGE: the configuration `map_jinja:sources` is only
                 configurable with `salt://parameters/map_jinja.yaml`
		 and `salt://{{ tplroot }}/parameters/map_jinja.yaml`

BREAKING CHANGE: the `map_jinja:config_get_roots` is replaced by
                 compound like `map_jinja:sources`

BREAKING CHANGE: the two `config_get_lookup` and `config_get` are
                 replaced by `C@<tplroot>:lookup` and `C@<tplroot>`
		 sources
2021-01-11 17:31:22 +01:00
Daniel Dehennin
3845d5ff61 fix(map): path_join can be used only for local file access
On windows machines, the `path_join` build wrong URL by using
backslash as separator.

URL used for fileserver access must use only slashes `/`.
2020-08-21 16:00:56 +02:00
Daniel Dehennin
ad4385b077 feat(map): config.get lookups from configurable roots
We avoid compatibility break with user pillars by looking up
configuration values using `config.get` in configurable roots.

We provide a new parameter `map_jinja:config_get_roots` in the formula
`parameters/defaults.yaml`to retrives values not only from
`tplroot=openssh` but from `sshd_config` and `ssh_config` too.

We need to update the `_mapdata` reference files to include the new
`map_jinja:config_get_roots`.
2020-07-31 12:59:33 +02:00
Daniel Dehennin
df477b25c2 feat(map): update to v4 “map.jinja”
The `map.jinja` now exports a single variable called `mapdata`.

We extract the `openssh`, `sshd_config` and `ssh_config` from it to
minimize the changes to `.sls` files.
2020-07-31 10:54:40 +02:00
Imran Iqbal
55560a6916
fix(map.jinja): fix salt-lint errors
```bash
Examining openssh/map.jinja of type state
[209] Jinja comment should have spaces before and after: {# comment #}
openssh/map.jinja:4
{## Start imports as  ##}

[209] Jinja comment should have spaces before and after: {# comment #}
openssh/map.jinja:19
{## merge the openssh pillar ##}
```
2019-10-09 15:01:26 +01:00
Alexander Weidinger
29b89f0fb9 map.jinja: replace defaults.merge with grains.filter_by 2019-02-12 19:11:46 +01:00
Alexander Weidinger
0c6a353969 Fix map.jinja: openssh:lookup is not used anyways 2019-02-12 19:02:57 +01:00
Alexander Weidinger
54dde36e53 split map.jinja according to template-formula 2019-02-12 14:55:15 +01:00
Jasper Lievisse Adriaanse
9845b1fddc Add support for Solaris; tested on SmartOS instance zone (#137) 2018-09-28 20:39:31 +02:00
Felipe Zipitría
6fbef86827
Add sftp subsystem debian (#3)
* Add map for debian
2018-04-25 17:48:47 -03:00
alxwr
5e3368afcb drop default values (fixes #102) (#117)
* drop default values (fixes #102)
* hmac-ripemd160 was dropped in 7.6
2017-10-23 20:18:11 +02:00
Alexander Weidinger
f4cf9aa22b CentOS 6: UsePrivilegeSeparation 'yes' (fixes #108) 2017-08-01 14:50:08 +02:00
Andres Montalban
467c5e56fc Remove extra whitespace 2017-07-27 19:06:27 -03:00
Alexander Weidinger
66c954ed66 Set correct ssh(d)_config_group for *BSD 2017-03-04 14:20:07 +01:00
Eric Cook
f4ea96f9c1 setup sftp correctly on RedHat-like machines 2017-01-24 18:17:15 -05:00
Eric Cook
51fd8b1391 fix Subsystem directive on archlinux 2016-10-30 00:06:02 -04:00
omltorg
de66dbee97 Update name of package containing dig on ArchLinux 2016-10-14 22:25:56 +00:00
Jonathon Anderson
87057c7c6b Correct openssh-clients package name for Red Hat 2016-07-01 23:53:00 -06:00
Forrest
22037f7b8b Merge pull request #63 from llua/arch_bind_utils
set dig_pkg on arch linux for issue #59
2016-05-09 20:52:42 -07:00
Eric Cook
dfb04a43b4 set dig_pkg on arch linux for issue #59 2016-05-09 23:47:57 -04:00
llua
bd8d46d784 add OpenBSD to map.jinja 2016-05-09 23:44:20 -04:00
Simon Lloyd
daed52de19 Add sshd_config to map.jinja and check if dig command is available before installing 'dig' package. 2016-04-19 02:53:14 +02:00
Theo Chatzimichos
0abbaac60d Fix the default Subystem sftp-server path for SLE 2016-03-23 14:41:25 +01:00
abednarik
3791b11380 Added default path for sftp Subsystem in FreeBSD 2015-11-29 15:56:17 -03:00
Imran Haider
4dddff0ccd Fix service name for Arch Linux 2015-06-20 14:24:51 -04:00
Niels Abspoel
ca62b7d118 Improve default lookup
Added defaults.yaml and map.jinja similar to template-formula and salt-formula
2015-06-02 22:52:59 +02:00
Raphaël Hertzog
1b74efd2d0 Add a new openssh.known_hosts state
This state manages /etc/ssh/ssh_known_hosts and fills it with
public SSH host keys of other minions.
2015-03-26 17:50:32 +01:00
Marc Schiffbauer
c6aeaf4dc5 add gentoo support 2015-03-23 14:56:12 +01:00
Marc Schiffbauer
28e0916840 sort distros alphabetically 2015-03-23 14:55:40 +01:00
Niels Abspoel
5871efb5bd added archlinux support to openssh map.jinja 2015-01-01 00:44:17 +01:00
Nitin Madhok
620cc0f199 Update map.jinja 2014-12-08 16:01:00 -05:00
Nitin Madhok
131a5cafcb Update map.jinja 2014-12-08 15:46:30 -05:00
Nitin Madhok
9263857193 Update map.jinja
Correct indentation
2014-12-08 15:43:40 -05:00
Niels Abspoel
1efce43d55 Added Opensuse support to map.jinja 2014-12-08 21:38:23 +01:00
Alan Pearce
edc208b79b Add FreeBSD compatibility 2014-08-08 13:38:27 +01:00
Kenny Do
6e418aa945 added a state that installs the openssh client 2014-01-18 05:00:20 -08:00
Kenny Do
0a2468d87a created a map.jinja and updated openssh state to use those values 2014-01-03 16:54:51 -08:00