minion.d/grains.conf file on windows salt agent

312 views
Skip to first unread message

Paul Mulvihill

unread,
Jan 13, 2017, 3:05:58 AM1/13/17
to Salt-users
Hi Everyone

Could anyone with Windows minions check and confirm they have the following working?
I have a windows salt minions and i am defining custom grains by creating a file
c:\salt\conf\minions.d\grains.conf
I use this to define key identity information that i use in pillar selection later.

When I run the salt agent without this file in place or a empty file the agent runs. connects to the salt master and seems happy.

However if i start to define custom grains within it
such as:
grains:
  location:
    LDN

The agent will start, it will make an initial connection to the salt master and then seem to loose connection and I can't issue commands from the salt master.
If i do a salt-run manage.up the box doesn't show up and if i perge unused keys the key is removed.
Restarting the agent will reregister it against the master and the same will happen.

I know the grain definition is fine because if I literally cut/paste the grain values from the grains.conf into the bottom of the minion config file, blank out lines in grains.conf and restart the agent is completely happy.

I've looked at the logs and nothing shows up as erroring so i'm a bit stumped. Am i the only one having this problem?

Has anyone else got the following working ok?

I've tried salt minion 2015.8.5 and 2016.11.1
both against a salt master 2016.11.1

Thanks

Paul

Loren Gordon

unread,
Jan 13, 2017, 5:58:06 AM1/13/17
to Salt-users
Try just:

location:
  LDN

That's how I do it.

I think setting the top-level `grains` key might actually wipe salt's built-in grains, which would break a bunch of stuff.

-Loren

Paul Mulvihill

unread,
Jan 13, 2017, 7:55:18 AM1/13/17
to Salt-users
Hi Loren

Thanks for the suggestion.. I just gave it a try although at least with 2016.11.1 that i'm running that doesn't seem to work.
I can't see the new grain when running
salt 'wintest2' grains.items

Also I have got this same setup on the centos and ubuntu equivilant and it works perfectly.

note if i have
grains:
  location:
    LDN
in the main minion file that doesn't overwrite anything.

Which versions of salt do you currently have running?

Paul

Loren Gordon

unread,
Jan 13, 2017, 8:14:16 AM1/13/17
to Salt-users
Ahh, sorry, I misspoke. We do set config items in the "C:\salt\conf\minion.d\" directory, but we still set grains in the "C:\salt\conf\grains" file. I'm afraid I'm no help after all, sorry for the distraction. :(

-Loren

Paul Mulvihill

unread,
Jan 13, 2017, 12:11:28 PM1/13/17
to Salt-users
Hi Loren

Thanks for that.. that may not be a distraction after all.. if the linux versions work with the same file then i can look at switching to use that approach. so it's the same accross platforms. I'll do some more digging.

Thanks

Paul

Loren Gordon

unread,
Jan 13, 2017, 12:36:46 PM1/13/17
to Salt-users
Yes, linux works the same way. Path is "/etc/salt/grains" in that case. That is the same file that is written when you use salt itself to write the grain, i.e. "salt-call --local grains.set foo bar"

-Loren
Reply all
Reply to author
Forward
0 new messages