【问题标题】:Unable to target salt minion using customized grains无法使用自定义颗粒来定位盐奴
【发布时间】:2019-03-20 18:24:38
【问题描述】:

我创建了一个带有 master 和 minion 的简单 Salt Stack Cluster。然后我在 /etc/salt/grains 文件中手动为 minion 添加了一个自定义的 grains。

mykey: hello-key

我在 master 中运行“salt '*' grains.items”时确实看到了这个键

  ...
  localhost:
        ip-172-31-24-109.us-west-2.compute.internal
    lsb_distrib_codename:
        CentOS Linux 7 (Core)
    lsb_distrib_id:
        CentOS Linux
    machine_id:
        b30d0f2110ac3807b210c19ede3ce88f
    manufacturer:
        Xen
    master:
        ec2-54-186-104-181.us-west-2.compute.amazonaws.com
    mdadm:
    mem_total:
        15883
    mykey:
        hello-key
    ...

现在有线部分是当我尝试通过我的自定义颗粒来瞄准这个小兵时,它不起作用,而其他所有方式都起作用!

[root@ip-172-31-28-130 ~]# salt '*' saltutil.refresh_modules
ip-172-31-24-109.us-west-2.compute.internal:
    True
[root@ip-172-31-28-130 ~]# salt '*' test.ping
ip-172-31-24-109.us-west-2.compute.internal:
    True
[root@ip-172-31-28-130 ~]# salt -G 'mem_total:*' test.ping
ip-172-31-24-109.us-west-2.compute.internal:
    True


[root@ip-172-31-28-130 ~]# salt -G 'mykey:hello-key' test.ping
ip-172-31-24-109.us-west-2.compute.internal:
    Minion did not return. [No response]

有人有什么想法或建议吗?

【问题讨论】:

  • 基本上每次我添加一个新的grain键值时,似乎我必须重新启动minion机器才能让它工作。几乎每次都被再现。只需按照该教程,在 AWS 上获取两台虚拟机,一个主一个仆从,在 minon 上添加一个新的粒度键值,然后运行 ​​salt -G 'newkey:newvalue' test.ping。除非我重新启动 minion 机器,否则它永远不会对我有用(我尝试了各种刷新)。

标签: salt-stack salt


【解决方案1】:

看来您确实有连接问题,而不是目标问题。 您的定位是可以的,如果不是,您会收到类似的消息

$ salt 'minion' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received

【讨论】:

  • 谢谢@daks,看来我必须重启minion机器才能让它工作。
  • 我认为这不是连接问题。如您所见,如果我使用 '*' 或任何旧颗粒,则奴才会正确响应。但是每当我添加一个新的grain,并尝试使用新的grain键值来定位minion时,就会出现“没有收到任何回报”。我认为这是 saltstack 中的一种错误
  • 你之前的评论让我觉得你已经解决了
猜你喜欢
  • 1970-01-01
  • 2017-08-24
  • 1970-01-01
  • 2023-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多