“Salt-ssh批量初始化机器”的版本间的差异
跳到导航
跳到搜索
(未显示同一用户的7个中间版本) | |||
第4行: | 第4行: | ||
=* 前提 机器购买下来 并作了 hostname 添加了puk key or 有密码= | =* 前提 机器购买下来 并作了 hostname 添加了puk key or 有密码= | ||
=* ins salt-ssh = | =* ins salt-ssh = | ||
+ | <pre> | ||
+ | |||
+ | cat /etc/salt/roster | ||
+ | # Sample salt-ssh config file | ||
+ | #web1: | ||
+ | # host: 192.168.42.1 # The IP addr or DNS hostname | ||
+ | # user: fred # Remote executions will be executed as user fred | ||
+ | # passwd: foobarbaz # The password to use for login, if omitted, keys are used | ||
+ | # sudo: True # Whether to sudo to root, not enabled by default | ||
+ | |||
+ | |||
+ | #上面其实就是配置 用户 密码什么的 也可以用key | ||
+ | yxps:~# salt-ssh '*' test.ping -i | ||
+ | 192.168.88.149: | ||
+ | True | ||
+ | |||
+ | </pre> | ||
+ | |||
=* 使用salt-ssh 批量安装salt-minion = | =* 使用salt-ssh 批量安装salt-minion = | ||
<pre> | <pre> | ||
第21行: | 第39行: | ||
salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' state.sls minions.7.install | salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' state.sls minions.7.install | ||
salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' cmd.run "systemctl restart salt-minion" | salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' cmd.run "systemctl restart salt-minion" | ||
+ | |||
+ | salt-ssh -ir '*' 'ps aux | grep salt' | grep salt | grep -v grep| wc -l ## 结果验证 查看安装minion端的salt-minion进程是否运行,一个客户端运行一个salt-minion服务。 | ||
然后 salt-key 接受各个 key | 然后 salt-key 接受各个 key | ||
第32行: | 第52行: | ||
https://github.com/BigbigY/salt-ssh-install-salt-minion | https://github.com/BigbigY/salt-ssh-install-salt-minion | ||
+ | |||
+ | [https://blog.51cto.com/zkhylt/1782990 Salt-ssh批量自动安装被控端minion] | ||
[https://www.cnblogs.com/jim-hwg/p/4940480.html 使用Salt-ssh部署Salt-minion之yum安装] | [https://www.cnblogs.com/jim-hwg/p/4940480.html 使用Salt-ssh部署Salt-minion之yum安装] | ||
+ | |||
+ | [https://www.cnblogs.com/dears/p/9138345.html Dear、 saltstack之ssh批量安装minion ] | ||
+ | |||
+ | [https://www.cnblogs.com/xiewenming/p/7716252.html SaltStack使用salt-ssh模式-第十一篇] | ||
+ | |||
+ | [https://www.jianshu.com/p/1de64126bfd5 slatstack(三)salt-ssh批量安装minion] | ||
+ | |||
+ | [https://blog.csdn.net/freshair_x/article/details/80296423 Salt-ssh批量自动安装被控端minion] | ||
+ | |||
+ | [https://www.cnblogs.com/dears/p/9138345.html saltstack之ssh批量安装minion ] |
2021年7月14日 (三) 03:09的最新版本
目录
* 前提 机器购买下来 并作了 hostname 添加了puk key or 有密码
* ins salt-ssh
cat /etc/salt/roster # Sample salt-ssh config file #web1: # host: 192.168.42.1 # The IP addr or DNS hostname # user: fred # Remote executions will be executed as user fred # passwd: foobarbaz # The password to use for login, if omitted, keys are used # sudo: True # Whether to sudo to root, not enabled by default #上面其实就是配置 用户 密码什么的 也可以用key yxps:~# salt-ssh '*' test.ping -i 192.168.88.149: True
* 使用salt-ssh 批量安装salt-minion
git clone https://github.com/evan886/ins-minionbysalt-ssh.git
** 文件
一定要用到的东西
srv/salt/minions/7 放到 /srv/salt/minion 目录
** 执行
minion配置文件根据自己master_ip修改,id根据自身情况获取 不改好像是自己的内网IP 我用的是 host所以得到是hostname 也就是要先机器起好hostname salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' state.sls minions.7.install salt-ssh --priv /data/evan/.mp --ignore-host-keys -i '*' cmd.run "systemctl restart salt-minion" salt-ssh -ir '*' 'ps aux | grep salt' | grep salt | grep -v grep| wc -l ## 结果验证 查看安装minion端的salt-minion进程是否运行,一个客户端运行一个salt-minion服务。 然后 salt-key 接受各个 key
*err
*然后 使用salt 完成 pubkey add autodisk osinit appins etc
see also
https://github.com/BigbigY/salt-ssh-install-salt-minion