yum安装salt-ssh报错:[root@linux-node1 yum.repos.d]# yum install salt-ssh -y
已加载插件:fastestmirror
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-ssh-2015.5.10-2.el7.noarch 需要
--> 解决依赖关系完成
错误:软件包:salt-ssh-2015.5.10-2.el7.noarch (epel)
需要:salt = 2015.5.10-2.el7
已安装: salt-2017.7.1-1.el7.noarch (@salt-latest)
salt = 2017.7.1-1.el7
可用: salt-2015.5.10-2.el7.noarch (epel)
salt = 2015.5.10-2.el7
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
根据报错提示加上参数“--skip-broken”,执行结果失败。[root@linux-node1 yum.repos.d]# yum install salt-ssh -y --skip-broken
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-ssh-2015.5.10-2.el7.noarch 需要
因为依赖关系问题而跳过的软件包:
salt-ssh-2015.5.10-2.el7.noarch 来自 epel
根据报错提示执行命令,再执行yum安装还是失败。[root@linux-node1 yum.repos.d]# rpm -Va --nofiles --nodigest
[root@linux-node1 yum.repos.d]# yum install salt-ssh -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-ssh-2015.5.10-2.el7.noarch 需要
--> 解决依赖关系完成
错误:软件包:salt-ssh-2015.5.10-2.el7.noarch (epel)
需要:salt = 2015.5.10-2.el7
已安装: salt-2017.7.1-1.el7.noarch (@salt-latest)
salt = 2017.7.1-1.el7
可用: salt-2015.5.10-2.el7.noarch (epel)
salt = 2015.5.10-2.el7
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
根据网友的帮助,直接下载salt-ssh命令:[root@linux-node1 yum.repos.d]# wget ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/Packages/s/salt-ssh-2015.5.10-2.el7.noarch.rpm
--2018-04-10 13:44:35-- ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/Packages/s/salt-ssh-2015.5.10-2.el7.noarch.rpm
=> “salt-ssh-2015.5.10-2.el7.noarch.rpm”
正在解析主机 mirror.switch.ch (mirror.switch.ch)... 130.59.113.36, 2001:620:0:1002::20
正在连接 mirror.switch.ch (mirror.switch.ch)|130.59.113.36|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD (1) /pool/4/mirror/epel/7/ppc64/Packages/s ... 完成。
==> SIZE salt-ssh-2015.5.10-2.el7.noarch.rpm ... 15108
==> PASV ... 完成。 ==> RETR salt-ssh-2015.5.10-2.el7.noarch.rpm ... 完成。
长度:15108 (15K) (非正式数据)
100%[=============================================================================================>] 15,108 22.0KB/s 用时 0.7s
2018-04-10 13:44:40 (22.0 KB/s) - “salt-ssh-2015.5.10-2.el7.noarch.rpm” 已保存 [15108]
rpm安装失败:[root@linux-node1 yum.repos.d]# rpm -ivh salt-ssh-2015.5.10-2.el7.noarch.rpm
错误:依赖检测失败:
salt = 2015.5.10-2.el7 被 salt-ssh-2015.5.10-2.el7.noarch 需要
rpm安装失败:加参数“--force”(忽略软件包及文件的冲突)[root@linux-node1 yum.repos.d]# rpm -ivh salt-ssh-2015.5.10-2.el7.noarch.rpm --force
错误:依赖检测失败:
salt = 2015.5.10-2.el7 被 salt-ssh-2015.5.10-2.el7.noarch 需要
rpm安装成功:再加参数“--nodeps”(不检查依赖性关系)[root@linux-node1 yum.repos.d]# rpm -ivh salt-ssh-2015.5.10-2.el7.noarch.rpm --force --nodeps
准备中... ################################# [100%]
正在升级/安装...
1:salt-ssh-2015.5.10-2.el7 ################################# [100%]
参考文档:https://www.cnblogs.com/vathe/p/6736104.html——CentOS下rpm命令详解
salt-ssh配置文件修改结果:[root@linux-node1 yum.repos.d]# cd ~
[root@linux-node1 ~]# 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
#web2:
# host: 192.168.42.2
linux-node1:
host: 192.168.56.11
user: root
passwd: 123123
port: 22
linux-node2:
host: 192.168.56.12
user: root
passwd: 123123
port: 22
执行salt-ssh命令失败:[root@linux-node1 ~]# salt-ssh '*' test.ping
[ERROR ] MySQL returner could not connect to database: (1045, "Access denied for user 'root'@'linux-node1' (using password: YES)")
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/client/ssh/__init__.py", line 617, in run
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load)
File "/usr/lib/python2.7/site-packages/salt/returners/mysql.py", line 321, in save_load
with _get_serv(commit=True) as cur:
File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/lib/python2.7/site-packages/salt/returners/mysql.py", line 258, in _get_serv
raise salt.exceptions.SaltMasterError('MySQL returner could not connect to database: {exc}'.format(exc=exc))
SaltMasterError: MySQL returner could not connect to database: (1045, "Access denied for user 'root'@'linux-node1' (using password: YES)")
[ERROR ] Could not save load with returner mysql: MySQL returner could not connect to database: (1045, "Access denied for user 'root'@'linux-node1' (using password: YES)")
[CRITICAL] MySQL returner could not connect to database: (1045, "Access denied for user 'root'@'linux-node1' (using password: YES)")
[CRITICAL] Could not store return with MySQL returner. MySQL server unavailable.
linux-node1:
----------
retcode:
254
stderr:
stdout:
The host key needs to be accepted, to auto accept run salt-ssh with the -i flag:
The authenticity of host '192.168.56.11 (192.168.56.11)' can't be established.
ECDSA key fingerprint is 2d:a2:8e:9e:5a:5c:fb:94:ac:80:ba:fa:7f:9e:3c:cd.
Are you sure you want to continue connecting (yes/no)?
[CRITICAL] MySQL returner could not connect to database: (1045, "Access denied for user 'root'@'linux-node1' (using password: YES)")
[CRITICAL] Could not store return with MySQL returner. MySQL server unavailable.
linux-node2:
True
此时yum安装salt-ssh,提示已安装此命令:[root@linux-node1 ~]# yum -y install salt-ssh
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 salt-ssh-2015.5.10-2.el7.noarch 已安装并且是最新版本
无须任何处理
通过yum方式删除前面通过rpm安装的salt-ssh命令:[root@linux-node1 ~]# yum remove salt-ssh-2015.5.10-2.el7.noarch
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在删除:
salt-ssh noarch 2015.5.10-2.el7 installed 3.1 k
事务概要
=======================================================================================================================================
移除 1 软件包
安装大小:3.1 k
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
正在删除 : salt-ssh-2015.5.10-2.el7.noarch 1/1
验证中 : salt-ssh-2015.5.10-2.el7.noarch 1/1
删除:
salt-ssh.noarch 0:2015.5.10-2.el7
完毕!
yum安装salt-ssh命令的问题复现:[root@linux-node1 ~]# yum -y install salt-ssh
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-ssh-2015.5.10-2.el7.noarch 需要
--> 解决依赖关系完成
错误:软件包:salt-ssh-2015.5.10-2.el7.noarch (epel)
需要:salt = 2015.5.10-2.el7
已安装: salt-2017.7.1-1.el7.noarch (@salt-latest)
salt = 2017.7.1-1.el7
可用: salt-2015.5.10-2.el7.noarch (epel)
salt = 2015.5.10-2.el7
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
通过yum方式删除前面命令执行输出里提到的“已安装”包:[root@linux-node1 ~]# yum remove salt-2017.7.1-1.el7.noarch
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt.noarch.0.2017.7.1-1.el7 将被 删除
--> 正在处理依赖关系 salt = 2017.7.1-1.el7,它被软件包 salt-minion-2017.7.1-1.el7.noarch 需要
--> 正在处理依赖关系 salt = 2017.7.1-1.el7,它被软件包 salt-master-2017.7.1-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 salt-master.noarch.0.2017.7.1-1.el7 将被 删除
---> 软件包 salt-minion.noarch.0.2017.7.1-1.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在删除:
salt noarch 2017.7.1-1.el7 @salt-latest 36 M
为依赖而移除:
salt-master noarch 2017.7.1-1.el7 @salt-latest 1.6 M
salt-minion noarch 2017.7.1-1.el7 @salt-latest 69 k
事务概要
=======================================================================================================================================
移除 1 软件包 (+2 依赖软件包)
安装大小:38 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : salt-minion-2017.7.1-1.el7.noarch 1/3
警告:/etc/salt/minion 已另存为 /etc/salt/minion.rpmsave
正在删除 : salt-master-2017.7.1-1.el7.noarch 2/3
警告:/etc/salt/master 已另存为 /etc/salt/master.rpmsave
正在删除 : salt-2017.7.1-1.el7.noarch 3/3
警告:/etc/salt/roster 已另存为 /etc/salt/roster.rpmsave
验证中 : salt-2017.7.1-1.el7.noarch 1/3
验证中 : salt-master-2017.7.1-1.el7.noarch 2/3
验证中 : salt-minion-2017.7.1-1.el7.noarch 3/3
删除:
salt.noarch 0:2017.7.1-1.el7
作为依赖被删除:
salt-master.noarch 0:2017.7.1-1.el7 salt-minion.noarch 0:2017.7.1-1.el7
完毕!
通过命令输出发现,master和minion包好像也被删除了。
yum安装salt-ssh成功:[root@linux-node1 ~]# yum -y install salt-ssh
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-ssh.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-ssh-2015.5.10-2.el7.noarch 需要
--> 正在检查事务
---> 软件包 salt.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 m2crypto,它被软件包 salt-2015.5.10-2.el7.noarch 需要
--> 正在检查事务
---> 软件包 m2crypto.x86_64.0.0.21.1-17.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在安装:
salt-ssh noarch 2015.5.10-2.el7 epel 15 k
为依赖而安装:
m2crypto x86_64 0.21.1-17.el7 base 429 k
salt noarch 2015.5.10-2.el7 epel 4.1 M
事务概要
=======================================================================================================================================
安装 1 软件包 (+2 依赖软件包)
总下载量:4.5 M
安装大小:20 M
Downloading packages:
(1/3): salt-ssh-2015.5.10-2.el7.noarch.rpm | 15 kB 00:00:00
(2/3): m2crypto-0.21.1-17.el7.x86_64.rpm | 429 kB 00:00:06
(3/3): salt-2015.5.10-2.el7.noarch.rpm | 4.1 MB 00:00:09
---------------------------------------------------------------------------------------------------------------------------------------
总计 476 kB/s | 4.5 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : m2crypto-0.21.1-17.el7.x86_64 1/3
正在安装 : salt-2015.5.10-2.el7.noarch 2/3
正在安装 : salt-ssh-2015.5.10-2.el7.noarch 3/3
验证中 : salt-2015.5.10-2.el7.noarch 1/3
验证中 : salt-ssh-2015.5.10-2.el7.noarch 2/3
验证中 : m2crypto-0.21.1-17.el7.x86_64 3/3
已安装:
salt-ssh.noarch 0:2015.5.10-2.el7
作为依赖被安装:
m2crypto.x86_64 0:0.21.1-17.el7 salt.noarch 0:2015.5.10-2.el7
完毕!
直接执行salt命令已无法执行,master和minion包应该是被删除了。[root@linux-node1 ~]# salt '*' test.ping
-bash: salt: 未找到命令
重新修改/etc/salt/roster文件后,测试salt-ssh:[root@linux-node1 ~]# salt-ssh '*' test.ping
linux-node2:
True
linux-node1:
True
按照之前讲解的部署saltstack的步骤重新yum安装salt-master(yum install salt-master -y)和salt-minion(yum install salt-minion -y),并修改/etc/salt/minion配置文件,分别启动salt-master(systemctl start salt-master)和salt-minion(systemctl start salt-minion),即可恢复正常使用salt-master和salt-minion。[root@linux-node1 ~]# salt '*' test.ping
linux-node1.example.com:
True
linux-node2.example.com:
True
salt-master和salt-minion恢复正常后,测试salt-ssh也没有问题:[root@linux-node1 ~]# salt-ssh '*' test.ping
linux-node1:
True
linux-node2:
True
在后面深入学习saltstack“配置管理”时,执行salt命令:“salt '*' state.highstate”,出现严重报错。[root@linux-node1 web]# salt '*' state.highstate
linux-node2.example.com:
Data failed to compile:
----------
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 3629, in call_highstate
top = self.get_top()
File "/usr/lib/python2.7/site-packages/salt/state.py", line 3089, in get_top
tops = self.get_tops()
File "/usr/lib/python2.7/site-packages/salt/state.py", line 2787, in get_tops
saltenv
File "/usr/lib/python2.7/site-packages/salt/fileclient.py", line 189, in cache_file
return self.get_url(path, '', True, saltenv, cachedir=cachedir)
File "/usr/lib/python2.7/site-packages/salt/fileclient.py", line 495, in get_url
result = self.get_file(url, dest, makedirs, saltenv, cachedir=cachedir)
File "/usr/lib/python2.7/site-packages/salt/fileclient.py", line 1044, in get_file
hash_server, stat_server = self.hash_and_stat_file(path, saltenv)
TypeError: 'bool' object is not iterable
linux-node1.example.com:
----------
ID: states
Function: no.None
Result: False
Comment: No Top file or external nodes data matches found.
Started:
Duration:
Changes:
Summary
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
ERROR: Minions returned with non-zero exit code
在上面的报错输出信息里,“linux-node1.example.com”节点的关键信息是“No Top file or external nodes data matches found.”。这个问题一直没有处理,但在梳理完前面的saltstack笔记后,这个报错信息自己消失。(在没有对这个节点做任何修改的情况下,后面执行“salt 'linux-node1*' state.highstate”命令,自行恢复正常。)[root@linux-node1 web]# salt 'linux-node1*' state.highstate
linux-node1.example.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 14:27:16.058668
Duration: 1902.564 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result: True
Comment: Service httpd is already enabled, and is in the desired state
Started: 14:27:17.962102
Duration: 418.927 ms
Changes:
Summary
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
下面着重说明“linux-node2.example.com”节点的故障处理:
由于执行“salt '*' test.ping”命令是正常的输出,最初就怀疑删除又重新安装master和minion包,导致有配置文件被重新安装包后,默认的配置文件会覆盖原有的配置文件。经过梳理前面整理过的笔记,发现这个怀疑几乎可以排除。[root@linux-node1 web]# salt '*' test.ping
linux-node2.example.com:
True
linux-node1.example.com:
True
不过,在梳理之前的saltstack笔记时,测试执行1条命令带给我新的发现:[root@linux-node1 salt]# salt '*' grains.get saltversion
linux-node2.example.com:
2017.7.1
linux-node1.example.com:
2015.5.10
执行命令的输出结果说明,2个节点的saltstack版本是不一样的。回看本文前面执行“yum remove salt-2017.7.1-1.el7.noarch”命令和重新执行“yum install salt-minion -y”命令的输出,基本也能做出这样的判断。
此时,我唯一能做的,就是把“linux-node2.example.com”节点的minion也删除重新安装试一试。
找到salt-minion配置文件的路径,先把minion文件备份:[root@linux-node2 ~]# cd /etc/salt/
[root@linux-node2 salt]# ll
总用量 124
-rw-r----- 1 root root 2624 8月 8 2017 cloud
drwxr-xr-x 2 root root 6 8月 8 2017 cloud.conf.d
drwxr-xr-x 2 root root 6 8月 8 2017 cloud.deploy.d
drwxr-xr-x 2 root root 6 8月 8 2017 cloud.maps.d
drwxr-xr-x 2 root root 6 8月 8 2017 cloud.profiles.d
drwxr-xr-x 2 root root 6 8月 8 2017 cloud.providers.d
-rw-r----- 1 root root 48789 8月 8 2017 master
drwxr-xr-x 2 root root 6 8月 8 2017 master.d
-rw-r----- 1 root root 34879 11月 9 19:21 minion
drwxr-xr-x 2 root root 27 9月 5 2017 minion.d
-rw-r--r-- 1 root root 23 9月 5 2017 minion_id
drwxr-xr-x 4 root root 32 9月 4 2017 pki
-rw-r----- 1 root root 28002 8月 8 2017 proxy
drwxr-xr-x 2 root root 6 8月 8 2017 proxy.d
-rw-r----- 1 root root 344 8月 8 2017 roster
[root@linux-node2 salt]# cp minion /tmp/
删除minion:[root@linux-node2 salt]# yum -y remove salt-minion
已加载插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-minion.noarch.0.2017.7.1-1.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在删除:
salt-minion noarch 2017.7.1-1.el7 @salt-latest 69 k
事务概要
=======================================================================================================================================
移除 1 软件包
安装大小:69 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : salt-minion-2017.7.1-1.el7.noarch 1/1
验证中 : salt-minion-2017.7.1-1.el7.noarch 1/1
删除:
salt-minion.noarch 0:2017.7.1-1.el7
完毕!
重新安装salt-minion竟然失败:原因“似曾相识”[root@linux-node2 salt]# yum install salt-minion -y
已加载插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base | 3.6 kB 00:00:00
centos-openstack-pike | 2.9 kB 00:00:00
centos-qemu-ev | 2.9 kB 00:00:00
epel/x86_64/metalink | 8.2 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
epel/x86_64/updateinfo FAILED
http://mirrors.nipa.cloud/epel/7/x86_64/repodata/0cf4a4a36afabff928c5aca5da8cc4cb50174d29fdec7dc56db18310146df319-updateinfo.xml.bz2: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
(1/7): centos-qemu-ev/7/x86_64/primary_db | 37 kB 00:00:01
(2/7): epel/x86_64/group_gz | 266 kB 00:00:04
(3/7): extras/7/x86_64/primary_db | 185 kB 00:00:04
(4/7): epel/x86_64/updateinfo | 909 kB 00:00:12
(5/7): updates/7/x86_64/primary_db | 6.9 MB 00:00:19
(6/7): centos-openstack-pike/x86_64/primary_db | 1.0 MB 00:00:26
(7/7): epel/x86_64/primary_db | 6.3 MB 00:00:38
Determining fastest mirrors
* base: mirror.bit.edu.cn
* epel: mirror01.idc.hinet.net
* extras: mirrors.cn99.com
* updates: mirror.bit.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-minion.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-minion-2015.5.10-2.el7.noarch 需要
--> 解决依赖关系完成
错误:软件包:salt-minion-2015.5.10-2.el7.noarch (epel)
需要:salt = 2015.5.10-2.el7
已安装: salt-2017.7.1-1.el7.noarch (@salt-latest)
salt = 2017.7.1-1.el7
可用: salt-2015.5.10-2.el7.noarch (epel)
salt = 2015.5.10-2.el7
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
这个删除包的操作之前在“linux-node1”上也执行过,算是这个问题的核心了。[root@linux-node2 salt]# yum -y remove salt-2017.7.1-1.el7.noarch
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt.noarch.0.2017.7.1-1.el7 将被 删除
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在删除:
salt noarch 2017.7.1-1.el7 @salt-latest 36 M
事务概要
=======================================================================================================================================
移除 1 软件包
安装大小:36 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在删除 : salt-2017.7.1-1.el7.noarch 1/1
警告:/etc/salt/minion 已另存为 /etc/salt/minion.rpmsave
验证中 : salt-2017.7.1-1.el7.noarch 1/1
删除:
salt.noarch 0:2017.7.1-1.el7
完毕!
再安装minion成功:[root@linux-node2 salt]# yum install salt-minion -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* epel: mirror01.idc.hinet.net
* extras: mirrors.cn99.com
* updates: mirror.bit.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 salt-minion.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 salt = 2015.5.10-2.el7,它被软件包 salt-minion-2015.5.10-2.el7.noarch 需要
--> 正在检查事务
---> 软件包 salt.noarch.0.2015.5.10-2.el7 将被 安装
--> 正在处理依赖关系 m2crypto,它被软件包 salt-2015.5.10-2.el7.noarch 需要
--> 正在检查事务
---> 软件包 m2crypto.x86_64.0.0.21.1-17.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================================================================================
Package 架构 版本 源 大小
=======================================================================================================================================
正在安装:
salt-minion noarch 2015.5.10-2.el7 epel 26 k
为依赖而安装:
m2crypto x86_64 0.21.1-17.el7 base 429 k
salt noarch 2015.5.10-2.el7 epel 4.1 M
事务概要
=======================================================================================================================================
安装 1 软件包 (+2 依赖软件包)
总下载量:4.5 M
安装大小:20 M
Downloading packages:
(1/3): m2crypto-0.21.1-17.el7.x86_64.rpm | 429 kB 00:00:00
(2/3): salt-minion-2015.5.10-2.el7.noarch.rpm | 26 kB 00:00:00
(3/3): salt-2015.5.10-2.el7.noarch.rpm | 4.1 MB 00:00:08
---------------------------------------------------------------------------------------------------------------------------------------
总计 511 kB/s | 4.5 MB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : m2crypto-0.21.1-17.el7.x86_64 1/3
正在安装 : salt-2015.5.10-2.el7.noarch 2/3
正在安装 : salt-minion-2015.5.10-2.el7.noarch 3/3
验证中 : salt-2015.5.10-2.el7.noarch 1/3
验证中 : salt-minion-2015.5.10-2.el7.noarch 2/3
验证中 : m2crypto-0.21.1-17.el7.x86_64 3/3
已安装:
salt-minion.noarch 0:2015.5.10-2.el7
作为依赖被安装:
m2crypto.x86_64 0:0.21.1-17.el7 salt.noarch 0:2015.5.10-2.el7
完毕!
重新安装的minion,它的默认配置文件(这个salt版本比较旧)和之前的minion配置文件(这个salt版本比较新)差异不小。这里备份一下。[root@linux-node2 salt]# mv minion /tmp/minion.ori
把之前备份的minion配置文件覆盖现有的配置文件:[root@linux-node2 salt]# mv /tmp/minion .
启动minion服务:[root@linux-node2 salt]# systemctl start salt-minion
在linux-node1节点上测试,只测试“node2”:[root@linux-node1 web]# salt 'linux-node2*' state.highstate
linux-node2.example.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 14:54:50.795000
Duration: 1276.067 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result: True
Comment: Service httpd is already enabled, and is in the desired state
Started: 14:54:52.071785
Duration: 351.635 ms
Changes:
Summary
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
已经成功。
执行最初的报错命令“salt '*' state.highstate”:也是成功的。[root@linux-node1 web]# salt '*' state.highstate
linux-node2.example.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 14:55:14.326489
Duration: 1508.146 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result: True
Comment: Service httpd is already enabled, and is in the desired state
Started: 14:55:15.835477
Duration: 368.446 ms
Changes:
Summary
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
linux-node1.example.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result: True
Comment: Package httpd is already installed.
Started: 14:55:14.582278
Duration: 5233.738 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result: True
Comment: Service httpd is already enabled, and is in the desired state
Started: 14:55:19.831056
Duration: 396.626 ms
Changes:
Summary
------------
Succeeded: 2
Failed: 0
------------
Total states run: 2
再次测试salt-ssh,也没有问题:[root@linux-node1 web]# salt-ssh '*' test.ping
linux-node2:
True
linux-node1:
True
最后的说明:2个版本的master和minion配置文件,里面的内容差异很大。为了尽快解决这个问题,这里就直接使用删除master、minion前的配置文件覆盖重新安装后配置文件。
至于具体的差异,以后再说。