On 1/10/14 9:59 AM, JC Lawrence wrote:
> On 10 Jan 2014, at 08:22, David Anderson <
da...@dubkat.com> wrote:
>
>> I'm confused - what do you mean there are no values for the mine_functions?
> I don't see any values in the pillar via `salt \* pillar.items` I'd (naively?) expected to.
You posted in your previous email that you are seeing the proper
mine_functions set in the pillar as applied by your top.sls:
$ salt dev-bastion pillar.items | fgrep -A 3 mine_functions
mine_functions:
----------
network.interfaces:
network.ip_addrs:
>
>> Everything is working as expected, which is to say you are telling all of your minions to run the network.interfaces and network.ip_addrs modules from the mine scheduler with no arguments. This is equivalent to running:
>>
>> salt '*' mine.send network.ip_addrs
>> and
>> salt '*' mine.send network.interfaces
>>
>> Instead of running strings on your mine file, you can use the 'mine.get' function on a minion to check the mine data. We should also add a cache.mine runner to make retrieving mine data on a master easier.
> Okay, let me start from the other end. Clearly I'm missing something basic and obvious-to-everyone-but-me and thus can't see the nose on my face.
>
> I want MinionA to find out what MinionB's IP address is. Even more specifically, I want to write a state which creates a configfile on MinionA which contains MinionB's IP address when all I know is the tag for MinionB..
>
> A) How would I do that?
From MinionA CLI:
salt-call mine.get 'MinionB' network.ip_addrs
This shows you the entire contents of network.ip_addrs that MinionB
sends to the mine on the master.
In a state, assuming you're using yaml|jinja:
your_minion_a_state_id:
file.managed:
- name: /tmp/minion_b_first_ip
- contents: {{ salt['mine.get']('MinionB',
'network.ip_addrs').get('MinionB')[0] }}
or use {%- set minionb_ip0 = salt['mine.get']... -%} to set a variable
for re-use in multiple places.
--
Dave