Targeting with grains not working in 2016.3.1
Description of Issue/Question
Targeting pre defined grains, such as os and os_family results in:
vagrant@saltmaster:~$ sudo salt -G 'os:Ubuntu' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
Setup
(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).) Using vagrant 1.8.1 and Virtualbox 5.0.20 r106931 Vagrant boxes used: ubuntu/trusty64 and centos/7 (same behavior here, as with the ubuntu box) Vagrantfile: https://github.com/Modulus/SaltJenkinsNginx/blob/master/Vagrantfile Master/Minion config and certs: https://github.com/Modulus/SaltJenkinsNginx/tree/master/etc
Steps to Reproduce Issue
These calls results in errors:
vagrant@saltmaster:~$ sudo salt -G "os:Ubuntu" test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
vagrant@saltmaster:~$ sudo salt -G "os_family:Debian" test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
vagrant@saltmaster:~$ sudo salt -G "os:CentOS" test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
These calls work fine:
vagrant@saltmaster:~$ sudo salt "*" grains.item os
minion1:
----------
os:
Ubuntu
minion2:
----------
os:
CentOS
vagrant@saltmaster:~$ sudo salt "*" grains.item os_family
minion2:
----------
os_family:
RedHat
minion1:
----------
os_family:
Debian
vagrant@saltmaster:~$ sudo salt -G "roles:build" test.ping
minion1:
True
vagrant@saltmaster:~$ sudo salt -G "roles:repository" test.ping
minion2:
True
Versions Report
vagrant@saltmaster:~$ salt --versions-report
Salt Version:
Salt: 2016.3.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-86-generic
system: Linux
version: Ubuntu 14.04 trusty
@Modulus I am having a hard time replicating this:
➜ salt sudo salt 'ch3ll-minion01' test.version -lwarning
ch3ll-minion01:
2016.3.1
➜ salt salt --version
salt 2016.3.1 (Boron)
➜ salt sudo salt -G "os:Ubuntu" test.ping -lwarning
ch3ll-minion01:
True
What version are your minions? Glancing at your vagrant file it looks like you are using the bootstrap script so I'm guessing your minions are also 2016.3.1 is that correct?
Do you see this behavior on 2016.3.0?
I have the same infra as @Modulus (using CentOs instead of Ubuntu though) and got the same error
[vagrant@saltmaster ~]$ sudo salt -G 'fqdn:nextgen-t1-db.schneider-electric.com' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
[vagrant@saltmaster ~]$ sudo salt '*' grains.item fqdn
windchilldatabase:
----------
fqdn:
nextgen-t1-db.schneider-electric.com
saltmaster:
----------
fqdn:
saltmaster
Strangely enough issuing a pillar refresh corrects that
[vagrant@saltmaster ~]$ sudo salt '*' saltutil.refresh_pillar
windchilldatabase:
True
saltmaster:
True
[vagrant@saltmaster ~]$ sudo salt -G 'fqdn:nextgen-t1-db.schneider-electric.com' test.ping
windchilldatabase:
True
Didn't happen in 2016.3.0
Looks like this issue might be in the cache lookup, if we can't determine that any minions will run the command then we don't run it, we fixed a performance bug in the cache lookup that may have triggered this. so like @CapBananoid running a pillar refresh does cause the minions to update the master cache.
@Ch3LL to reproduce this, try to shut down the master, rm -rf /var/cache/salt, restart the master and then try to grain match on minions that were already running.
I'm still having a hard time replicating this issue, but when removing the cache I found what looks like a possibly a different issue.
➜ salt sudo salt -G "os:Centos" test.ping -lwarning
ch3ll-master:
True
ch3ll-minion01:
Minion did not return. [No response]
➜ salt sudo salt ch3ll-minion01 grains.item os -lwarning
ch3ll-minion01:
----------
os:
Ubuntu
As shown above I get True back from the centos minion but Minion did not return fromt eh ubuntu minion which I shouldn't even be attempting to ping that machine.
@Modulus or @CapBananoid are either of you using a master job cache? Or any other information you can provide about your environment that might help to replicate this issue
@Ch3LL Im using 2016.3.1, I have not tested it in version 2016.3.0 yet. doing a pillar_refresh seems to do the trick. Both the Ubuntu and Centos Nodes are responding after sudo salt "*" saltutil.pillar_refresh
Okay I think i've found out some more information. I am only able to replicate this when the following is set in the minion:
grains:
roles:
- build
Which is what is in @Modulus minion. I replicated this using the salt vagrant demo here and adding the above to each minion confiuration file. When these settings are not in the file it works just fine.
@Ch3LL I still can't replicate it even with that. Did you remove the cache and then start the minion with that grains block in the minion config? I was using 2016.3.1.
@cachedout this was on startup of a brand new installation using that vagrant setup. I was not able to replicate the issue outside of @Modulus 's vagrant file until i added the custom grains to a separate vagrant setup.
But weirdly enough I just tried it on my own setup and cannot replicate it with the custom grains in the minion config file and removing the master cache. Let me try a new setup in the cloud and report back.
@Ch3LL I don't want to get into this one until we can reproduce it outside of that Vagrant image. Thanks.
Okay weird I cannot replicate it in the cloud either only in that vagrant environment. any other ideas on what to test?
I just upgraded to 2015.8.10 and installed salt-syndic as well, and am seeing the symptoms described above. At the time, I also switch my hash_type so I also did clear out /var/cache/salt/* on all of my masters and minions.
From the master of masters, if I try to target a minions using either a built in grain such as manufacturer or a grain that I defined in the minion config, it appears that all minions are targeted. If the minion does not have the grain defined, I get a Minion did not return message.
I have dug deeper into the issue that I posted above. It does appear to be a separate issue that is posted by OP, but is the same issue as mentioned by @Ch3LL. I recently upgraded to 2015.8.10, during this process I switched from md5 hash_type to sha256. I cleared the master and minion cache on everything. Now, when I attempt to target boxes that have a grain defined in their minion file, I will get 'Minion did not return. [No response]' for boxes that I know don't have that grain.
What I have concluded is that, for the minions that are in the 'No response' group, my master does not have a directory for it under /var/cache/salt/master/minions/. All these minions in this group have been offline since I wiped the cache and have not had a chance to update the master. So it appears that the master is basically telling us that it didn't get a response when it was looking up the grains from the cache. I'm not sure if this is intented or not, but this appears to replicate the issue described by Ch3LL above.
Salt Version:
Salt: 2015.8.10
Dependency Versions:
Jinja2: 2.7.2
M2Crypto: 0.21.1
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.7.0
Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.7
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: centos 7.2.1511 Core
machine: x86_64
release: 3.10.0-229.11.1.el7.x86_64
system: CentOS Linux 7.2.1511 Core
same issue here, upgraded from 2015.8.3+ds-1 to 2016.3.1+ds-1 and 2016.3.2+ds-1 on debian 8.
where i'd previously be able to target via 'os:Debian' on the syndic master i can not now, the output is immediate and consistent across 2016.3.1&2 :
salt -G 'os:Debian' cmd.run "apt-get upgrade -s" No minions matched the target. No command was sent, no jid was assigned. ERROR: No return received
after doing the following :
- upgrade everything to 2016.3.2+ds-1
- rm -rf /var/cache/salt/master/minions/* (on the syndic master)
- salt '*' saltutil.refresh_pillar
targeting with grains started to work again :
salt -G "os:Debian" test.ping test0: True test1: True test2: True
ymmv
update :
now i can't match via usual host globbing as follows :
salt 'test?' cmd.run "apt-get upgrade -s" No minions matched the target. No command was sent, no jid was assigned. ERROR: No return received
I was having the same issue with 2017.7.1.
# salt '*' grains.get hostenv
sit1-mysql:
sit1
# salt -G 'hostenv:sit1' grains.get hostenv
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
After the minions are restarted, it's gone..
salt 'sit1-mysql' grains.get hostenv
sit1-mysql:
sit1
# salt -C 'G@hostenv:sit1 and G@roles:mysql' test.ping
sit1-mysql:
True
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.