11296/pillar-jinja-error-on-iteritems
I was trying to use the iterations via piller data and jinja template. I am using most of the template from a working salt/pillar installation. But now its failing to work in new environment.
I have tried several different syntaxes with the implementation of the iteration but still get same error.
Rendering SLS 'base:pillar_lab_user' failed: Jinja variable 'str object'
Jinja Template
{% set users = salt['pillar.get']('XXXXXXX') %}
{% for user, args in users.iteritems() %}
{{ user }}:
user.present:
- fullname: {{ args.fullname }}
- uid: {{ args.uid }}
- gid_from_name: True
- shell: {{ args.shell }}
{% if not args.empty_password == true %}
- password: {{ args.password }}
{% else %}
- empty_password: {{ args.empty_password }}
{% endif %}
{% if 'groups' in args %}
- groups: {{ args['groups'] }}
{% endif %}
{% endfor %}
Pillar Data
users:
user1:
fullname: User1 Fullname
uid: 951
gid: 951
shell: /bin/bash
groups:
- sudo
- admin
password: (REMOVED)
pub_ssh_keys: (REMOVED)
user2:
fullname: User2 Fullname
uid: 955
gid: 955
shell: /bin/bash
groups:
- sudo
- admin
password: (REMOVED)
pub_ssh_keys: (REMOVED)
Your data should fail with :
Rendering SLS 'base:so' failed: Jinja variable 'dict object' has no attribute 'empty_password'
The error that you’re seeing is probably because of non-existing pillar data.
You've pasted full pillar data but left XXXXXXX in state file.
Try using this
{% set users = salt['pillar.get']('users') %}
Or
check if you use pillarenv, then remember to pass the correct one, you can simply verify this in command line:
salt 'your minion' pillar.get users
If it doesn't return your dictionary then try:
salt 'your minion' pillar.get users pillarenv=your_pillar_env
or
It could be a user the pillar configuration was not formed properly
Removed the first line "{% set users = salt['pillar.get']('XXXXXXX') %}"
It wont use pillar.get
This should work fine
The issue which you are facing is ...READ MORE
There are API docs in the footer ...READ MORE
As to how to integrate git repo ..
Download necessary CA certificate.
"/etc/ssl/certs/ca-certificates.crt", -> Debian/Ubuntu "/etc/pki/tls/certs/ca-bundle.crt", ...READ MORE
Seems like Capistrano can't connect to the server ...READ MORE
OR
Already have an account? Sign in.