1、自动化运维之SaltStack实践
自动化运维之SaltStack实践
linux-node1(master服务端) | 192.168.0.15 |
linux-node2(minion客户端) | 192.168.0.16 |
Local | 本地 |
Master/Minion | 传统运行方式(server端跟agent端) |
Salt SSH | SSH |
[root@linux-node1 yum.repos.d]# ping linux-node1.zhurui.com
PING linux-node1.zhurui.com (192.168.0.15)56(84) bytes of data.
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=1 ttl=64 time=0.087 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=2 ttl=64 time=0.060 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=3 ttl=64 time=0.053 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=4 ttl=64 time=0.060 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=5 ttl=64 time=0.053 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=6 ttl=64 time=0.052 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=7 ttl=64 time=0.214 ms
64 bytes from linux-node1.zhurui.com (192.168.0.15): icmp_seq=8 ttl=64 time=0.061 ms
[root@linux-node1 minion]# salt-key -a linux*
The following keys are going to be accepted:
UnacceptedKeys:
linux-node1.zhurui.com
linux-node2.zhurui.com
Proceed?[n/Y] Y
Keyfor minion linux-node1.zhurui.com accepted.
Keyfor minion linux-node2.zhurui.com accepted.
[root@linux-node1 minion]# salt-key
AcceptedKeys:
linux-node1.zhurui.com
linux-node2.zhurui.com
DeniedKeys:
UnacceptedKeys:
RejectedKeys:
[root@linux-node1 salt]# salt '*' state.sls apache
linux-node2.zhurui.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result:True
Comment:Package httpd is already installed.
Started:22:38:52.954973
Duration:1102.909 ms
Changes:
----------
ID: apache-install
Function: pkg.installed
Name: httpd-devel
Result:True
Comment:Package httpd-devel is already installed.
Started:22:38:54.058190
Duration:0.629 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result:True
Comment:Service httpd has been enabled, and is running
Started:22:38:54.059569
Duration:1630.938 ms
Changes:
----------
httpd:
True
Summary
------------
Succeeded:3(changed=1)
Failed:0
------------
Total states run:3
linux-node1.zhurui.com:
----------
ID: apache-install
Function: pkg.installed
Name: httpd
Result:True
Comment:Package httpd is already installed.
Started:05:01:17.491217
Duration:1305.282 ms
Changes:
----------
ID: apache-install
Function: pkg.installed
Name: httpd-devel
Result:True
Comment:Package httpd-devel is already installed.
Started:05:01:18.796746
Duration:0.64 ms
Changes:
----------
ID: apache-service
Function: service.running
Name: httpd
Result:True
Comment:Service httpd has been enabled, and is running
Started:05:01:18.798131
Duration:1719.618 ms
Changes:
----------
httpd:
True
Summary
------------
Succeeded:3(changed=1)
Failed:0
------------
Total states run:3
[root@linux-node1 salt]#
[root@linux-node1 salt]# salt 'linux-node1*' grains.ls
linux-node1.zhurui.com:
-SSDs
- biosreleasedate
- biosversion
- cpu_flags
- cpu_model
- cpuarch
- domain
- fqdn
- fqdn_ip4
- fqdn_ip6
- gpus
- host
- hwaddr_interfaces
- id
- init
- ip4_interfaces
- ip6_interfaces
- ip_interfaces
- ipv4
- ipv6
- kernel
- kernelrelease
- locale_info
- localhost
- lsb_distrib_codename
- lsb_distrib_id
- lsb_distrib_release
- machine_id
- manufacturer
- master
- mdadm
- mem_total
- nodename
- num_cpus
- num_gpus
- os
- os_family
- osarch
- oscodename
- osfinger
- osfullname
- osmajorrelease
- osrelease
- osrelease_info
- path
- productname
- ps
- pythonexecutable
- pythonpath
- pythonversion
- saltpath
- saltversion
- saltversioninfo
- selinux
- serialnumber
- server_id
- shell
- virtual
- zmqversion
[root@linux-node1 salt]#
[root@linux-node1 salt]# salt 'linux-node1*' grains.items
linux-node1.zhurui.com:
----------
SSDs:
biosreleasedate:
07/31/2013
biosversion:
6.00
cpu_flags:
- fpu
- vme
- de
- pse
- tsc
- msr
- pae
- mce
- cx8
- apic
- sep
- mtrr
- pge
- mca
- cmov
- pat
- pse36
- clflush
- dts
- mmx
- fxsr
- sse
- sse2
- ss
- syscall
- nx
- rdtscp
- lm
- constant_tsc
- up
- arch_perfmon
- pebs
- bts
- xtopology
- tsc_reliable
- nonstop_tsc
- aperfmperf
- unfair_spinlock
- pni
- ssse3
- cx16
- sse4_1
- sse4_2
- x2apic
- popcnt
- hypervisor
- lahf_lm
- arat
- dts
cpu_model:
Intel(R)Core(TM) i3 CPU M 380@2.53GHz
cpuarch:
x86_64
domain:
zhurui.com
fqdn:
linux-node1.zhurui.com
fqdn_ip4:
-192.168.0.15
fqdn_ip6:
gpus:
|_
----------
model:
SVGA II Adapter
vendor:
unknown
host:
linux-node1
hwaddr_interfaces:
----------
eth0:
00:0c:29:fc:ba:90
lo:
00:00:00:00:00:00
id:
linux-node1.zhurui.com
init:
upstart
ip4_interfaces:
----------
eth0:
-192.168.0.15
lo:
-127.0.0.1
ip6_interfaces:
----------
eth0:
- fe80::20c:29ff:fefc:ba90
lo:
-::1
ip_interfaces:
----------
eth0:
-192.168.0.15
- fe80::20c:29ff:fefc:ba90
lo:
-127.0.0.1
-::1
ipv4:
-127.0.0.1
-192.168.0.15
ipv6:
-::1
- fe80::20c:29ff:fefc:ba90
kernel:
Linux
kernelrelease:
2.6.32-573.el6.x86_64
locale_info:
----------
defaultencoding:
UTF8
defaultlanguage:
en_US
detectedencoding:
UTF-8
localhost:
linux-node1.zhurui.com
lsb_distrib_codename:
Final
lsb_distrib_id:
CentOS
lsb_distrib_release:
6.7
machine_id:
da5383e82ce4b8d8a76b5a3e00000010
manufacturer:
VMware,Inc.
master:
192.168.0.15
mdadm:
mem_total:
556
nodename:
linux-node1.zhurui.com
num_cpus:
1
num_gpus:
1
os:
CentOS
os_family:
RedHat
osarch:
x86_64
oscodename:
Final
osfinger:
CentOS-6
osfullname:
CentOS
osmajorrelease:
6
osrelease:
6.7
osrelease_info:
-6
-7
path:
/sbin:/usr/sbin:/bin:/usr/bin
productname:
VMwareVirtualPlatform
ps:
ps -efH
pythonexecutable:
/usr/bin/python2.6
pythonpath:
-/usr/bin
-/usr/lib64/python26.zip
-/usr/lib64/python2.6
-/usr/lib64/python2.6/plat-linux2
-/usr/lib64/python2.6/lib-tk
-/usr/lib64/python2.6/lib-old
-/usr/lib64/python2.6/lib-dynload
-/usr/lib64/python2.6/site-packages
-/usr/lib64/python2.6/site-packages/gtk-2.0
-/usr/lib/python2.6/site-packages
pythonversion:
-2
-6
-6
- final
-0
saltpath:
/usr/lib/python2.6/site-packages/salt
saltversion:
2015.5.10
saltversioninfo:
-2015
-5
-10
-0
selinux:
----------
enabled:
True
enforced:
Permissive
serialnumber:
VMware-564d8f43912d3a99-eb c4 3b a9 34 fc ba 90
server_id:
295577080
shell:
/bin/bash
virtual:
VMware
zmqversion:
3.2.5
名称 | 存储位置 | 数据类型 | 数据采集更新方式 | 应用 |
Grains | minion端 | 静态数据 | minion启动时收集,也可以使用saltutil.sync_grains进行刷新。 | 存储minion基本数据,比如用于匹配minion,自身数据可以用来做资产管理等。 |
Pillar | master端 | 动态数据 | 在master端定义,指定给对应的minion,可以使用saltutil.refresh_pillar刷新 | 存储Master指定的数据,只有指定的minion可以看到,用于敏感数据保存。 |
1、自动化运维之SaltStack实践的更多相关文章
- saltstack自动化运维系列⑧SaltStack实践配置管理安装nginx-1.10.3
saltstack自动化运维系列⑧SaltStack实践配置管理安装nginx-1.10.3 安装nginx-1.10.3.tar.gz # mkdir -p /srv/salt/prod/pkg / ...
- saltstack自动化运维系列⑦SaltStack实践配置管理安装zabbix
saltstack自动化运维系列⑥SaltStack实践配置管理安装zabbix 1.添加管理zabbix的sls文件# vim /srv/salt/base/init/zabbix_agent.sl ...
- saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived
saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy的Keepalived 安装配置Keepalived 1.编写功能模块 #创建keepalived目录# mkdir -p ...
- saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy
saltstack自动化运维系列⑥SaltStack实践安装配置HAproxy 下载haproxy1.6.2.tar.gz下载地址:http://www.haproxy.org/download/1. ...
- 自动化运维之SaltStack实践
自动化运维之SaltStack实践 1.1.环境 linux-node1(master服务端) 192.168.0.15 linux-node2(minion客户端) 192.168.0.16 1.2 ...
- 自动化运维之Saltstack
第三十八课 自动化运维之Saltstack 目录 一.自动化运维介绍 二. saltstack安装 三. 启动saltstack服务 四. saltstack配置认证 五. saltstack远程执行 ...
- saltstack自动化运维系列⑩SaltStack二次开发初探
saltstack自动化运维系列⑩SaltStack二次开发初探 1.当salt运行在公网或者网络环境较差的条件下,需要配置timeout时间vim /etc/salt/master timeout: ...
- 自动化运维工具 SaltStack 搭建
原文地址:https://www.ibm.com/developerworks/cn/opensource/os-devops-saltstack-in-cloud/index.html#N10072 ...
- 自动化运维工具SaltStack详细部署【转】
==========================================================================================一.基础介绍==== ...
随机推荐
- zabbix监控mysql性能
使用zabbix监控mysql的三种方式 1.只是安装agent 2.启用模板监控 3.启用自定义脚本的模板监控 zabbix中默认有mysql的监控模板.默认已经在zabbix2.2及以上的版本中. ...
- spring+jotm+ibatis+mysql实现JTA分布式事务
1 环境 1.1 软件环境 spring-framework-2.5.6.SEC01-with-dependencies.zip ibatis-2.3.4 ow2-jotm-dist-2.1.4-b ...
- 【转】拍拍网2015年mysql最新开发规范
1.命名规范 (1)库名.表名.字段名必须使用小写字母,并采用下划线分割. (2)库名.表名.字段名禁止超过32个字符. (3)库名.表名.字段名必须见名知意.命名与业务.产品线等相关联. (4)库名 ...
- 基于Go的websocket消息服务
3个月没写PHP了,这是我的第一个中小型go的websocket微服务.那么问题来了,github上那么多轮子,我为什么要自己造轮子呢? Why 造轮子? 因为这样不仅能锻炼自己的技术能力,而且能帮助 ...
- 数据结构 之 二叉堆(Heap)
注:本节主要讨论最大堆(最小堆同理). 一.堆的概念 堆,又称二叉堆.同二叉查找树一样,堆也有两个性质,即结构性和堆序性. 1.结构性质: 堆是一棵被完全填满的二叉树,有可能的 ...
- InfluxDB介绍
InfluxDB介绍 InfluxDB用Go语言编写的一个开源分布式时序.事件和指标数据库,和传统是数据库相比有不少不同的地方. 类似的数据库有Elasticsearch.Graphite等. 特点 ...
- iOS 社交化分享功能
iOS 开发过程中可能会遇到需要进行第三方分享的需求,比如向QQ,微信,微博等分享 如下图 我们今天要讲到的方式是使用了一个第三方工具: http://www.sharesdk.cn 一,注册账号 去 ...
- POI读取excel文件。
1) poi读取现成.xls文件,不需要自己建立.xls ====ReadExcel类==== package cust.com.excelToDataTest; import java.io.F ...
- 列表(list) ----python
Python 列表(List) 序列是Python中最基本的数据结构.序列中的每个元素都分配一个数字 - 它的位置,或索引,第一个索引是0,第二个索引是1,依此类推. Python有6个序列的内置类型 ...
- 一副美丽而庞大的SQL TUNING计划美图
最近因为很忙,一直忙着开发公司的产品和客户的事情,杂七杂八,忙的不亦乐乎,所以,好久没有来这里写东西,这两天为客户优化了一个系统,优化前CPU持续冲顶爆满,导致系统卡死,应用系统不能正常使用,其中有个 ...