How to use cmd_yaml in external pillar

496 views
Skip to first unread message

Luis Pugoy

unread,
Dec 2, 2013, 4:24:06 AM12/2/13
to salt-...@googlegroups.com
I'm trying to figure out how to use external pillars in SaltStack. I've added the following lines to /etc/salt/master:

ext_pillar:  
  - cmd_yaml: cat /srv/mysql.sls

The file /srv/mysql.sls has the following:

mysql:
  root_pw: password

Now I'm trying to figure out how to integrate this in /srv/pillar/top.sls, but during my research I haven't come across any source that shows how. I saw this for git_pillar but it doesn't give me much. Do I need to add

base:
  '*':
    - foo

to /srv/mysql.sls as well?

Xavier Barbosa

unread,
Dec 2, 2013, 4:41:06 AM12/2/13
to salt-...@googlegroups.com
your pillar is exposed to all minions.

it's accessible into sls files with this jinja variable.


    {{ pillar['mysql']['root_pw'] }}

Luis Pugoy

unread,
Dec 2, 2013, 4:46:02 AM12/2/13
to salt-...@googlegroups.com
Hi Xavier,

I see. There's no way to target external pillars?


--
You received this message because you are subscribed to a topic in the Google Groups "Salt-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/salt-users/2_AvdzqvOAU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Colton Myers

unread,
Dec 2, 2013, 1:04:00 PM12/2/13
to salt-...@googlegroups.com
External pillars have access to the grains for the minions, and need to do their own processing on those grains to make sure they return the right pillar data for the right minions (top.sls is not used for external pillars). cmd_yaml is more of an example, and is not meant for production use.  (It can't target minions, because it doesn't have the processing required, as it's not templated through jinja or anything)

--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.

Luis Pugoy

unread,
Dec 3, 2013, 12:05:00 AM12/3/13
to salt-...@googlegroups.com
Hi Colton,

I see, thanks for the explanation. It's better if this information is available directly in the docs though. I'd be willing to update it but I don't know how.

Seth House

unread,
Dec 3, 2013, 2:02:25 AM12/3/13
to salt-...@googlegroups.com
A clarification to the docs would be most welcome! You can find the
docs inline in the source code.

https://github.com/saltstack/salt/blob/develop/salt/pillar/cmd_yaml.py

...maps to:

http://docs.saltstack.com/ref/pillar/all/salt.pillar.cmd_yaml.html
Reply all
Reply to author
Forward
0 new messages