已存在salt中的机器,为了规范,需要将这批主机改名

操作流程:在master把这批机器剔除;然修改这批机器的主机名、在/etc/salt目录下、用mv把minion_id和pki的目录重命名、重启salt-minion服务(在mster段能再次监控到这台主机后、可把上面重命名的文件删除)

环境:http://www.cnblogs.com/zzzhfo/p/6126223.html

把salt-client-01改名为salt-minion-01

  • 在salt-server上把salt-client-01剔除
[root@salt-server /]# salt-key -L
Accepted Keys:
salt-client-
salt-client-
Denied Keys:
Unaccepted Keys:
Rejected Keys: [root@salt-server /]# salt-key -d 'salt-client-01' -y
Deleting the following keys:
Accepted Keys:
salt-client-
Key for minion salt-client- deleted.
[root@salt-server /]# salt-key -L
Accepted Keys:
salt-client-
Denied Keys:
Unaccepted Keys:
salt-client-01
Rejected Keys:

修改主机名

[root@salt-client- /]# cat /etc/sysconfig/network  #重启生效
NETWORKING=yes
HOSTNAME=salt-minion-
[root@salt-client- /]# hostname salt-minion-
[root@salt-client- /]# bash

删除minion_id和pki(建议使用mv命令)

[root@salt-minion- /]# cd /etc/salt/
[root@salt-minion- salt]#mv minion_id minion_id.bak
[root@salt-minion- salt]# mv pki pki.bak
[root@salt-minion- salt]# /etc/init.d/salt-minion restart
Stopping salt-minion daemon: [ OK ]
Starting salt-minion daemon: [ OK ]
[root@salt-minion- salt]# ls
minion minion.d minion_id minion_id.bak pki pki.bak

查看minion的日志信息

error :salt主缓存节点的公钥,这盐奴才将等待10秒前试图认证

[root@salt-minion- salt]# tail /var/log/salt/minion
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate
-- ::, [salt.crypt ][ERROR ][] The Salt Master has cached the public key for this node, this salt minion will wait for seconds before attempting to re-authenticate

在master端重新认证(可能存在延迟、多刷新几次)

[root@salt-server master]# salt-key -L
Accepted Keys:
salt-client-
Denied Keys:
Unaccepted Keys:
salt-client-
salt-minion-
Rejected Keys:
[root@salt-server master]# salt-key -a 'salt-minion-01' -y
The following keys are going to be accepted:
Unaccepted Keys:
salt-minion-
Key for minion salt-minion- accepted.
[root@salt-server master]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
salt-client-
Rejected Keys:
[root@salt-server master]# salt '*' test.ping
salt-minion-:
True
salt-client-:
True

上面用salt-key -L 查看到salt-client-01在等待认证,是因为缓存的原因

[root@salt-server master]# pwd
/etc/salt/pki/master
[root@salt-server master]# ll minions #通过认证的key
total
-rw-r--r--. root root Sep : salt-client-
-rw-r--r--. root root Sep : salt-minion-
[root@salt-server master]# ll minions_pre 等待认证的key
total
-rw-r--r--. root root Sep : salt-client-
[root@salt-server master]# cd minions_pre
[root@salt-server minions_pre]# ls
salt-client- #把它删除 再次查看就不会存在了
[root@salt-server minions_pre]# rm -rf salt-client-
[root@salt-server minions_pre]# ls
[root@salt-server minions_pre]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt-server minions_pre]# salt-key -L
Accepted Keys:
salt-client-
salt-minion-
Denied Keys:
Unaccepted Keys:
Rejected Keys:
[root@salt-server minions_pre]# salt '*' test.ping
salt-minion-:
True
salt-client-:
True
[root@salt-server minions_pre]# salt '*' cmd.run 'df -h'
salt-minion-:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 917M 16G % /
tmpfs 495M 12K 495M % /dev/shm
/dev/sda1 485M 31M 429M % /boot
salt-client-:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 18G 916M 16G % /
tmpfs 495M 12K 495M % /dev/shm
/dev/sda1 485M 31M 429M % /boot

saltstack(主机改名)的更多相关文章

  1. saltstack主机管理项目:主机管理项目架构设计(二)

    1.salt架构图 https://docs.saltstack.com/en/getstarted/system/plugins.html plug-ins(左边):场景可插拔 subsystem- ...

  2. saltstack主机管理项目【day23】:主机管理项目需求分析-设计

    本节内容 一. 主机管理项目需求分析 二 .主机管理项目架构设计 三.主机管理项目初始构建 四. 主机管理项目编主机分发器 一. 主机管理项目需求分析 场景:我现在又一台裸机要实现一下人物 配置管理: ...

  3. saltstack主机管理项目:编写插件基类-获取主机列表-提取yaml配置文件(四)

    一.编写插件基类 1.目录结构 1.我是如何获知我有多少种系统? 当客户端第一连接过来的时候,我就已经把这些文件存下来了 ,存在到哪里了?存到数据库了 每次对主机发送命令的动作时,我从库里把数据取出来 ...

  4. saltstack主机管理项目:今日总结(六)

    一.总目录 二.具体代码 salt #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:luoahong import os,sys if __ ...

  5. saltstack主机管理项目【day39】:主机管理项目开发

    项目目标 salt state.apply -h "ubuntu,centos" -g "ubuntu,centos" -f "ubuntu,cent ...

  6. saltstack主机管理项目:主机管理项目需求分析(一)

    1.场景: 我现在又一台裸机要实现一下任务 2.配置管理: 1.装上nginx,mysql 2.nginx用我指定的配置文件 3.mysql用户 4.设置一个默认的数据库访问权限 5.启动mysql ...

  7. saltstack主机管理项目:计主机管理项目命令分发器(三)

    一.开发目标命令格式如下: 二.目录结构 三.代码注解 01.salt.py 只是一个入口,没干什么事情 #!/usr/bin/env python # -*- coding:utf-8 -*- # ...

  8. saltstack主机管理项目:动态调用插件解析-模块解析(五)

    一.动态调用插件解析 1.目录结构 1.base_module代码解析: def syntax_parser(self,section_name,mod_name,mod_data): print(& ...

  9. RabbitMQ、RPC、SaltStack "贡"具的使用

    消息队列 使用队列的场景 在程序系统中,例如外卖系统,订单系统,库存系统,优先级较高 发红包,发邮件,发短信,app消息推送等任务优先级很低,很适合交给消息队列去处理,以便于程序系统更快的处理其他请求 ...

随机推荐

  1. BZOJ 2243: [SDOI2011]染色 [树链剖分]

    2243: [SDOI2011]染色 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 6651  Solved: 2432[Submit][Status ...

  2. jQuery与Struts2综合应用[stream/json]

    一.使用stream类型的Result实现Ajax 具体步骤: ① 定义InputStream类型的成员变量及getter和setter ②具体业务方法中将要发送到客户端的json字符串赋值给成员变量 ...

  3. ESXi5.5下的Centos7虚机配置静态IP

    使用的是osboxes.org上下载的已安装centos7 image, 在启动后, ifconfig不能看到网卡, 需要关机后在ESXi客户端编辑虚机, 删除网卡, 保存, 添加网卡, 网卡类型选择 ...

  4. OrchardNoCMS模块生成工具命令简化

    OrchardNoCMS模块生成工具命令行简化列表:   目前只有codegen feature和cultures三个命令. 对应的都进行了参数简化. 例如:codegen module 简化为cod ...

  5. PlayMaker的应用

    PlayMaker属于一个可视化的状态机编辑工具,集成到了Unity的IDE里,在Unity的市场上很受欢迎,本人看见后第一感觉是跟CryEngine的那个状态机特别相似.CE的那个状态机编辑器其实是 ...

  6. C语言与内存模型初探

    #include<stdio.h> #include<string.h> int main(){ long long int a = 2<<30; char str ...

  7. SpringBean_获取Spring加载的所有bean(实践)

      一.查询代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 3 ...

  8. 泛型-List<T>

    声明一个int类型的泛型对象 List<int> list=new List<int>(); list.Add(44);//不用装箱 int i1=list[0];//也不会发 ...

  9. Ubuntu默认防火墙安装、启用、配置、端口、查看状态相关信息

    Ubuntu附带了一个相对iptables简单很多的防火墙 配置工具:ufw ufw防火墙 即uncomplicated firewall,不复杂的防火墙,繁琐部分的设置还是需要去到iptables ...

  10. CentOS 6.8_x64 Oracle 12C 安装

    1.下载地址 (需要注册oracle账号) 点击 2.登录CentOS 做准备工作 groupadd oinstall groupadd dba useradd -g oinstall -g dba ...