Hello,
I am coming from puppet and am now trying to learning saltstack. I would like to find a "best practice way2 to install different versions of the same config file (eg /etc/ssh/sshd_config) for say different linux distros (Ubuntu, SLES, ...). So after all I would like to have a grain like os_family or any other that makes sense to be part of a source path like shown below:
openssh-server.sls:
openssh_server_conf:
file.managed:
- name: /etc/ssh/sshd_config,
- source: {{ salt['pillar.get']('openssh_server:lookup:config:grains["osfullname"]') }}
- source: {{ salt['pillar.get']('openssh_server:lookup:config:default') }}
with pillar: openssh_server.sls:
openssh-server:
lookup:
config:
Ubuntu:salt://openssh-server/files/Ubuntu/etc/ssh/sshd_config
default: salt://openssh-server/files/etc/ssh/sshd_config
However this results in an empty ssh file beeing installed. It seems that the grain osfullname is not correctly evaluated.
so something does not work as I expected.
If I add a single source path using:
- source: salt://openssh-server/files/{{ grains['osfullname'] }}/etc/ssh/sshd_config
it works as expected, but it would be nice to have the openssh-server -pillar as a additional abstraction layer.
Any idea how to get this working?
Thanks a lot
Rainer