master端报错信息:

[root@RS1 ~]# salt -G 'roles:nginx' test.ping
[WARNING ] Key grains with value roles:nginx env:prod has an invalid type of <type 'str'>, a dict is required for this value
[WARNING ] Key grains with value roles:nginx env:prod has an invalid type of <type 'str'>, a dict is required for this value
[WARNING ] Key grains with value roles:nginx env:prod has an invalid type of <type 'str'>, a dict is required for this value
[WARNING ] Key grains with value roles:nginx env:prod has an invalid type of <type 'str'>, a dict is required for this value
minion.saltstack.com:
    True

minion端的配置:

[root@redis01 ~]# egrep -v '#|^$' /etc/salt/minion
master: 10.10.10.131
id: minion.saltstack.com
mysql.host: '10.10.10.131'
mysql.user: 'salt'
mysql.pass: 'salt'
mysql.db: 'salt'
mysql.port: 3306
grains:
  roles: nginx
  env: prod

小结:主要是因为yaml的格式问题,之前以为是minion端的问题,后来发现是自己配置master的时候出了点格式问题,重新调整后,多半可以解决。