D
D
Dmitry Kalinnikov2018-06-20 11:26:04
linux
Dmitry Kalinnikov, 2018-06-20 11:26:04

How to use Jinja in Salt master config?

During the setup process, SaltStack wanted something strange - to use the Jinja template engine to upload the config to the master.
But, quite naturally, this is not done on the forehead. To process pillars, he needs a running master, to run the master, he needs a working config.
An example where you want to use it:

{% set services = pillar.services %}
gitfs_remotes:
  {% for service in services %}
  - {{ 'ssh://[email protected]/services/' ~ service ~ '.git:' }}
    - mountpoint: {{ 'salt://' ~ service ~ '/' }}
  {% endfor %}

Those. we store a list of services in pillar, and salt substitutes them in the config.
Is there a correct way/beautiful hack how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2018-06-20
@Growman

If I understand the question correctly, then there are several ways to go:
If master is new:
1. Raise the master with the default config, then apply the state to yourself.
2. Install salt-ssh, fill in the roster only for the salt-master node and apply the state to it to deploy the master. It is done even from a local wheelbarrow.
If master already exists, then there is no problem at all - just apply the state

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question