salt-master salt-cloud not acting idempotent

末鹿安然 提交于 2019-12-25 07:24:56

问题


I am trying to test salt-cloud saltify to deploy/install salt-minions on target machines.

I created three vagrant machines and names them master, minion-01and minion-02.

all the machines were same like this;

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

then on master I followed this http://repo.saltstack.com/#ubuntu to install salt-master(manually ofcourse).

then in master I added these three files.

in /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

in /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

then on minion I ran salt-cloud -m /etc/salt/saltify-map It was very slow but It ran without errors. keys of both minion-01 and minion-02 was accepted by salt master.

I could do this:

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

and this;

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

The Problem;

Now when I again executed this salt-cloud -m /etc/salt/saltify-map salt-master re-ran the whole execution and then I had this;

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

and this;

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

In short salt-cloud is not acting idempotent.

What am I doing wrong ?

The second problem is, though on the first run salt-cloud -m /etc/salt/saltify-map installs and accepts key of minion-01 and minion-02 on salt-master, but the minion machines have all these things installed along with 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 

How do I make sure that only salt-minion gets installed.

Thanks.

PS:

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

回答1:


You write: "It was very slow":

You have set script_args to values that install everything from Github from source. You might want to remove the parameters (or use different parameters) to have a fast installation of a pre-packaged version. Please see https://github.com/saltstack/salt-bootstrap and specifically bootstrap-salt.sh for the available options.

You write: "salt-cloud is not acting idempotent":

You're doing everything correctly. salt-cloud is not idempotent. As far as I know it is not designed to be idempotent.

You write: "the minion machines have all these things installed along with salt-minion"

It might be the case due to using the git parameters and installing it from source. Please try a pre-packaged version of Salt.




回答2:


Vagrant doesn't destroy the machines between runs, does it?

By the looks of it, on the second run the salt minions have started with new keys and re-registered with the master. Because they've got the same names it's all got confused .....

Try "vagrant destroy" before running, so that the machines are fresh each time?




回答3:


FWIW, this is also being tracked as a bug in Salt though at present, it cannot be duplicated: https://github.com/saltstack/salt/issues/34687




回答4:


It appears its a saltify bug. So, can't do anything about this question. The bug is reported and hopefully this will get solved in a future release.



来源:https://stackoverflow.com/questions/38390216/salt-master-salt-cloud-not-acting-idempotent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!