Skip to content

Instantly share code, notes, and snippets.

@tedski
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedski/67965ba33392fd5a566f to your computer and use it in GitHub Desktop.
Save tedski/67965ba33392fd5a566f to your computer and use it in GitHub Desktop.
{% if salt['cmd.retcode']('id foouser') %}
id:
state.method:
- args
{% endif %}
@N-Mi
Copy link

N-Mi commented May 12, 2014

/srv/pillar/openssh.sls

openssh:
  auth:
{%- if salt['cmd.ret_code']('id toto') %}
    toto:
      - name: 'pouetpouetpouet'
        present: True
        enc: ssh-dss
        comment: test key
 {%- endif -%}

highstate output

    Data failed to compile:
----------
    Pillar failed to render with the following messages:
----------
    Rendering SLS 'openssh' failed, render error:
Jinja variable 'dict object' has no attribute 'cmd.ret_code'; line 47


---
[...]
{%- if salt['cmd.ret_code']('id toto') %}    <======================
    toto:
      - name: 'pouetpouetpouet'
        present: True
        enc: ssh-dss
        comment: test key
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment