Skip to content

Understanding map files #66938

Answered by bdrx312
bradawk1 asked this question in Q&A
Discussion options

You must be logged in to vote

You can just create a users.yaml file and import it with import_yaml

users.yaml:

2: sid1
3: sid2
17: sid3
# import your yaml data ...
{% import_yaml "users.yaml" as users %}

# now you can use it something like...
{%- for port, sid in users.items() %}
"/etc/systemd/system/vncserver@:{{ port }}.service"
  file.managed:
     - user: root
     - group: root
     - mode: '0644'
     - source: "salt://{{ tpldir }}/etc/systemd/system/vncserver.service.j2"
     - template: jinja
     - context:
         sid: "{{ sid }}"  
{% endfor %}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by bradawk1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants