【问题标题】:salt-master salt-cloud not acting idempotentsalt-master salt-cloud 不是幂等的
【发布时间】:2016-07-15 07:24:21
【问题描述】:

我正在尝试测试 salt-cloud saltify 在目标机器上部署/安装 salt-minions。

我创建了三台流浪机器并将它们命名为ma​​sterminion-01minion-02

所有的机器都是这样的;

root@master:/home/vagrant# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty

然后在主人我跟着这个http://repo.saltstack.com/#ubuntu 安装 salt-master(当然是手动安装)。

然后在master中我添加了这三个文件。

/etc/salt/cloud.providers:

root@master:/etc/salt/cloud.providers.d# cat bare_metal.conf 
my-saltify-config:
  minion:
    master: 192.168.33.10
  driver: saltify

/etc/salt/cloud.profiles.d:

root@master:/etc/salt/cloud.profiles.d# cat saltify.conf 
make_salty:
  provider: my-saltify-config
  script_args: git v2016.3.1

/etc/salt/saltify-map

root@master:/etc/salt# cat saltify-map 
make_salty:
  - minion-01:
      ssh_host: 192.168.33.11
      ssh_username: vagrant
      password: vagrant
  - minion-02:
      ssh_host: 192.168.33.12
      ssh_username: vagrant
      password: vagrant

然后我在 minion 上运行 salt-cloud -m /etc/salt/saltify-map 它非常慢,但运行时没有错误。 minion-01 和 minion-02 的密钥都被 salt master 接受了。

我可以这样做:

   root@master:/home/vagrant# salt 'minion*' test.ping
    minion-01:
        True
    minion-02:
        True

还有这个;

root@master:/home/vagrant# salt-key 
Accepted Keys:
minion-01
minion-02
Denied Keys:
Unaccepted Keys:
Rejected Keys:

问题;

现在当我再次执行此salt-cloud -m /etc/salt/saltify-map salt-master 重新运行了整个执行过程,然后我有了这个;

root@master:/home/vagrant# salt 'minion*' test.ping
minion-02:
    Minion did not return. [No response]
minion-01:
    Minion did not return. [No response]

还有这个;

root@master:/etc/salt# salt-key 
Accepted Keys:
minion-01
minion-02
Denied Keys:
minion-01
minion-02
Unaccepted Keys:
Rejected Keys:

简而言之,盐云不具有幂等性

我做错了什么?

第二个问题是,虽然在第一次运行时salt-cloud -m /etc/salt/saltify-map 在 salt-master 上安装并接受 minion-01minion-02 的密钥,但 minion机器已经安装了所有这些东西以及salt-minion

root@minion-02:/home/vagrant# salt
salt         salt-call    salt-cp      salt-master  salt-proxy   salt-ssh     salt-unity
salt-api     salt-cloud   salt-key     salt-minion  salt-run     salt-syndic 

如何确保只安装 salt-minion

谢谢。

PS:

root@master:/etc/salt# salt-master --version
salt-master 2016.3.1 (Boron)

【问题讨论】:

    标签: salt-stack idempotent


    【解决方案1】:

    你写道:“它很慢”

    您已将 script_args 设置为从源代码安装来自 Github 的所有内容的值。您可能希望删除参数(或使用不同的参数)以快速安装预打包版本。请参阅https://github.com/saltstack/salt-bootstrap,特别是bootstrap-salt.sh,了解可用选项。

    您写道:“salt-cloud 不具有幂等性”

    你做的一切都是正确的。 salt-cloud 不是幂等的。据我所知,它并非设计为幂等的。

    您写道:“minion 机器已经安装了所有这些东西以及 salt-minion”

    这可能是由于使用了git 参数并从源安装它。请尝试预打包的 Salt 版本。

    【讨论】:

      【解决方案2】:

      Vagrant 不会在运行之间破坏机器,是吗?

      从外观上看,在第二次运行中,salt minions 已使用新密钥开始并重新注册到 master。因为名字一样,所以都搞糊涂了.....

      在运行前尝试“vagrant destroy”,让机器每次都是新鲜的?

      【讨论】:

        【解决方案3】:

        FWIW,这也是 Salt 中的一个错误,但目前无法复制:https://github.com/saltstack/salt/issues/34687

        【讨论】:

          【解决方案4】:

          它似乎是一个saltify 错误。所以,对这个问题无能为力。该错误已报告,希望这将在未来的版本中得到解决。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2022-12-16
            相关资源
            最近更新 更多