0

When using salt for specifying user creation, it is unorganized to have the for statement in a single line. Example:

{% for USR in 'hewey','dewey','loui' %}

Is it possible to break this into separate lines like:

{% for USR in %}
{% 'hewey', %}
{% 'dewey', %}
{% 'loui' %}

I'm unable to find anything about this with Google Fu.

0

{% for USR in 'hewey','dewey','loui' %}

I'm not even sure this works, but this

{% for USR in ['hewey','dewey','loui'] %}

should.

Answering your 'format' question, I don't think it's possible (and even desirable). If you want to create users from a list of 'names' you should use pillar to inject this data. It will allow you to separate processing (create users) from data (hewey, dewey, loui).

You can start reading Getting Started Tutorial and this page about pillar https://docs.saltstack.com/en/getstarted/config/pillar.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.