I hope someone can help me 🙂.
I have stored ssh keys in vault as a secret. With saltstack config I am reading the secret with a pillar. Like this
docker:
{% set sshkey = salt['vault'].read_secret('super/secret/sshinfo', 'slackbot') %}
sshkey: |
{{ sshkey | indent(4) }}
And init.sls
file looks like this:
{% set docker_config = pillar['docker'] %}
git-key:
file.managed:
- name: /root/.ssh/slack-bot
- contents: {{ docker_config.sshkey }}
- mode: 400
- user: root
Which works great and I get the ssh key by typing salt-call pillar.items
However, when I run salt-call state.apply
I get the following error message
local:
Data failed to compile:
----------
Rendering SLS 'base:docker' failed: could not find expected ':'
Which is driving me nuts!
I read Mulitline string on Github that in order to write mulitline with salt you need to have | indent(4)
(as an example).
Does someone have any ideas? Would be much appreciated 🙂
So, after a while I tried to change indent(4)
to indent(5)
, but it didn't gave up the error. So I also tried to change content
to be
- contents: |
{{ docker_config.sshkey | indent(5) }}
Which fixed the problem and is now working.
Hope anyone who has similar problems find this useful.
Cheers!