SaltStack本地管理无master模式-第八篇
Salt本地管理应用场景
1.在边缘节点服务器非常少没有Salt-master
2.零售店,电影院等弱网络环境没有Salt-master
3.快速部署单个服务没有Salt-master
实现
一,安装minion
[root@linux-node1 ~]# yum install -y salt-minion
二,更改minon配置文件,红色部分为新增加
[root@linux-node1 ~]# cat /etc/salt/minion
# defined below by setting it to "local". Setting a local file_client runs the
#file_client: remote #默认remote 使用的远程Master模式
file_client: local #新增加一行 使用本地模式
....
# Example:
# file_roots:
# base:
# - /srv/salt/
# dev:
# - /srv/salt/dev/services
# - /srv/salt/dev/states
# prod:
# - /srv/salt/prod/services
# - /srv/salt/prod/states
#
file_roots:
base:
- /srv/salt/base
dev:
- /srv/salt/dev
test:
- /srv/salt/test
prod:
- /srv/salt/prod
.....
三,无需启动minion
[root@linux-node1 ~]# systemctl stop salt-minion
四,查看本地状态文件,以安装一个tomcat为列
[root@linux-node1 base]# cat /srv/salt/base/web/tomcat.sls
jdk-install:
pkg.installed:
- name: java-1.8.-openjdk tomcat-install:
file.managed:
- name: /usr/local/src/apache-tomcat-8.0..tar.gz
- source: salt://web/files/apache-tomcat-8.0.46.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
- unless: test -L /usr/local/tomcat && test -d /usr/local/apache-tomcat-8.0.
五,salt-call测试
[root@linux-node1 ~]# salt-call --local test.ping
local:
True
六,使用salt-call执行本地状态文件
root@linux-node1 base]# salt-call --local state.sls web.tomcat
[INFO ] Loading fresh modules for state activity
[INFO ] Fetching file from saltenv 'base', ** done ** 'web/tomcat.sls'
[INFO ] Running state [java-1.8.-openjdk] at time ::34.066323
[INFO ] Executing state pkg.installed for java-1.8.-openjdk
[INFO ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[INFO ] Executing command ['repoquery', '--plugins', '--queryformat', '%{NAME}_|-%{ARCH}', '--pkgnarrow=all', '--all'] in directory '/root'
[INFO ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[INFO ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[INFO ] Executing command ['yum', '-y', 'install', 'java-1.8.0-openjdk'] in directory '/root'
[INFO ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[INFO ] Installed Packages:
'nss-pem' changed from 'absent' to '1.0.3-4.el7'
'nss-tools' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'libXi' changed from 'absent' to '1.7.9-1.el7'
'python-javapackages' changed from 'absent' to '3.4.1-11.el7'
'xorg-x11-font-utils' changed from 'absent' to '1:7.5-20.el7'
'libXcomposite' changed from 'absent' to '0.4.4-4.1.el7'
'libICE' changed from 'absent' to '1.0.9-9.el7'
'nss-sysinit' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'copy-jdk-configs' changed from 'absent' to '2.2-3.el7'
'tzdata-java' changed from 'absent' to '2017b-1.el7'
'libXrender' changed from 'absent' to '0.9.10-1.el7'
'lksctp-tools' changed from 'absent' to '1.0.17-2.el7'
'xorg-x11-fonts-Type1' changed from 'absent' to '7.5-9.el7'
'libXfont' changed from 'absent' to '1.5.2-1.el7'
'chkconfig' changed from '1.3.61-5.el7_2.1' to '1.7.4-1.el7'
'libfontenc' changed from 'absent' to '1.1.3-3.el7'
'java-1.8.0-openjdk' changed from 'absent' to '1:1.8.0.144-0.b01.el7_4'
'python-lxml' changed from 'absent' to '3.2.1-4.el7'
'javapackages-tools' changed from 'absent' to '3.4.1-11.el7'
'java-1.8.0-openjdk-headless' changed from 'absent' to '1:1.8.0.144-0.b01.el7_4'
'nss' changed from '3.21.0-9.el7_2' to '3.28.4-15.el7_4'
'libXext' changed from 'absent' to '1.3.3-3.el7'
'nspr' changed from '4.11.0-1.el7_2' to '4.13.1-1.0.el7_3'
'nss-util' changed from '3.21.0-2.2.el7_2' to '3.28.4-3.el7'
'giflib' changed from 'absent' to '4.1.6-9.el7'
'libXtst' changed from 'absent' to '1.2.3-1.el7'
'nss-softokn' changed from '3.16.2.3-14.2.el7_2' to '3.28.3-8.el7_4'
'libSM' changed from 'absent' to '1.2.2-2.el7'
'nss-softokn-freebl' changed from '3.16.2.3-14.2.el7_2' to '3.28.3-8.el7_4'
'ttmkfdir' changed from 'absent' to '3.0.9-42.el7' [INFO ] Loading fresh modules for state activity
[INFO ] Completed state [java-1.8.-openjdk] at time ::17.648075
[INFO ] Running state [/usr/local/src/apache-tomcat-8.0..tar.gz] at time ::17.654621
[INFO ] Executing state file.managed for /usr/local/src/apache-tomcat-8.0..tar.gz
[INFO ] Fetching file from saltenv 'base', ** done ** 'web/files/apache-tomcat-8.0.46.tar.gz'
[INFO ] File changed:
New file
[INFO ] Completed state [/usr/local/src/apache-tomcat-8.0..tar.gz] at time ::17.811524
[INFO ] Running state [cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat] at time ::17.812426
[INFO ] Executing state cmd.run for cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
[INFO ] Executing command 'test -L /usr/local/tomcat && test -d /usr/local/apache-tomcat-8.0.46' in directory '/root'
[INFO ] Executing command 'cd /usr/local/src && tar zxf apache-tomcat-8.0.46.tar.gz && mv apache-tomcat-8.0.46 /usr/local/ && ln -s /usr/local/apache-tomcat-8.0.46 /usr/local/tomcat' in directory '/root'
[INFO ] {'pid': , 'retcode': , 'stderr': '', 'stdout': ''}
[INFO ] Completed state [cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat] at time ::18.311686
local:
----------
ID: jdk-install
Function: pkg.installed
Name: java-1.8.-openjdk
Result: True
Comment: The following packages were installed/updated: java-1.8.-openjdk
Started: ::34.066323
Duration: 283581.752 ms
Changes:
----------
chkconfig:
----------
new:
1.7.-.el7
old:
1.3.-.el7_2.
copy-jdk-configs:
----------
new:
2.2-.el7
old:
giflib:
----------
new:
4.1.-.el7
old:
java-1.8.-openjdk:
----------
new:
:1.8.0.144-.b01.el7_4
old:
java-1.8.-openjdk-headless:
----------
new:
:1.8.0.144-.b01.el7_4
old:
javapackages-tools:
----------
new:
3.4.-.el7
old:
libICE:
----------
new:
1.0.-.el7
old:
libSM:
----------
new:
1.2.-.el7
old:
libXcomposite:
----------
new:
0.4.-4.1.el7
old:
libXext:
----------
new:
1.3.-.el7
old:
libXfont:
----------
new:
1.5.-.el7
old:
libXi:
----------
new:
1.7.-.el7
old:
libXrender:
----------
new:
0.9.-.el7
old:
libXtst:
----------
new:
1.2.-.el7
old:
libfontenc:
----------
new:
1.1.-.el7
old:
lksctp-tools:
----------
new:
1.0.-.el7
old:
nspr:
----------
new:
4.13.-1.0.el7_3
old:
4.11.-.el7_2
nss:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-pem:
----------
new:
1.0.-.el7
old:
nss-softokn:
----------
new:
3.28.-.el7_4
old:
3.16.2.3-14.2.el7_2
nss-softokn-freebl:
----------
new:
3.28.-.el7_4
old:
3.16.2.3-14.2.el7_2
nss-sysinit:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-tools:
----------
new:
3.28.-.el7_4
old:
3.21.-.el7_2
nss-util:
----------
new:
3.28.-.el7
old:
3.21.-2.2.el7_2
python-javapackages:
----------
new:
3.4.-.el7
old:
python-lxml:
----------
new:
3.2.-.el7
old:
ttmkfdir:
----------
new:
3.0.-.el7
old:
tzdata-java:
----------
new:
2017b-.el7
old:
xorg-x11-font-utils:
----------
new:
:7.5-.el7
old:
xorg-x11-fonts-Type1:
----------
new:
7.5-.el7
old:
----------
ID: tomcat-install
Function: file.managed
Name: /usr/local/src/apache-tomcat-8.0..tar.gz
Result: True
Comment: File /usr/local/src/apache-tomcat-8.0..tar.gz updated
Started: ::17.654621
Duration: 156.903 ms
Changes:
----------
diff:
New file
mode: ----------
ID: tomcat-install
Function: cmd.run
Name: cd /usr/local/src && tar zxf apache-tomcat-8.0..tar.gz && mv apache-tomcat-8.0. /usr/local/ && ln -s /usr/local/apache-tomcat-8.0. /usr/local/tomcat
Result: True
Comment: Command "cd /usr/local/src && tar zxf apache-tomcat-8.0.46.tar.gz && mv apache-tomcat-8.0.46 /usr/local/ && ln -s /usr/local/apache-tomcat-8.0.46 /usr/local/tomcat" run
Started: ::17.812426
Duration: 499.26 ms
Changes:
----------
pid: retcode: stderr:
stdout: Summary
------------
Succeeded: (changed=)
Failed:
------------
Total states run:
salt-call --local state.sls web.tomcat
总结
1.本地管理模式,无需salt-master
2.本地管理模式,不需要启动minion服务
附 赵班长的 GitHub saltbook-code网址
https://github.com/unixhot/saltbook-code/tree/master
SaltStack本地管理无master模式-第八篇的更多相关文章
- Saltstack实战之无master和多master
如果不想依赖master可以设置为无master vim /etc/salt/minion 就可以通过minion来安装一个salt-master了(下来查资料做,关闭salt-minion进程因为不 ...
- Saltstack_使用指南14_无master
1. 主机规划 salt 版本 [root@salt100 ~]# salt --version salt (Oxygen) [root@salt100 ~]# salt-minion --versi ...
- SaltStack之无Master和多Master(九)
SaltStack之无Master和多Master Masterless架构,无Master 实现方式: 1)关闭minion进程 2)修改配置文件 vi /etc/salt/minion file_ ...
- Spring Cloud实战 | 最八篇:Spring Cloud +Spring Security OAuth2+ Axios前后端分离模式下无感刷新实现JWT续期
一. 前言 记得上一篇Spring Cloud的文章关于如何使JWT失效进行了理论结合代码实践的说明,想当然的以为那篇会是基于Spring Cloud统一认证架构系列的最终篇.但关于JWT另外还有一个 ...
- 2.配置通过数据库接收SaltStack批量管理日志
2.配置通过数据库接收SaltStack批量管理日志 2016-07-04 10:02:52来源:oschina作者:eddy_linux人点击 默认情况下发送给salt minion的命令执 ...
- RocketMQ环境搭建(双master模式)
介绍: 多Master模式,一个集群无Slave,全是Master,例如2个Master或者3个Master. 优点:配置简单,单个Master宕机或重启维护对应用无影响,在磁盘配置为RAID10时, ...
- 学习笔记37—WIN7系统本地连接没有有效的IP地址 电脑本地连接无有效ip配置怎么办
WIN7系统本地连接没有有效的IP地址 电脑本地连接无有效ip配置怎么办 家中有两台笔记本都有无线网卡,现在想让两台笔记本都能够上网,而又不想购买路由器,交换机等设备,这个时候怎么办呢? 其实只要进行 ...
- RockerMQ介绍 及搭建双master模式
一.RocketMQ介绍 1.1 简介 RocketMQ 是一款分布式.队列模型的消息中间件,具有以下特点: 能够保证严格的消息顺序 提供丰富的消息拉取模式 高效的订阅者水平扩展能力 实时的消息订阅机 ...
- 本地管理表空间和字典管理表空间的特点,ASSM有什么特点
字典管理表空间(Dictionary-Managed Tablespace简称DMT),8i以前包括以后都还可以使用的一种表空间管理模式,通过数据字典管理表空间的空间使用. Oracle使用两个字典来 ...
随机推荐
- Go语言 关键字:defer
defer和go一样都是Go语言提供的关键字.defer用于资源的释放,会在函数返回之前进行调用.一般采用如下模式: f,err := os.Open(filename) if err != nil ...
- HDU_5538_House Building
House Building Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) ...
- windows server 2008 R2域中的DC部署 分类: AD域 Windows服务 2015-06-06 21:09 68人阅读 评论(0) 收藏
整个晚上脑子都有点呆滞,想起申请注册好的博客还从来都不曾打理,上来添添生机.从哪里讲起呢,去年有那么一段时间整个人就陷在域里拔不出来,于是整理了一些文档,害怕自己糊里糊涂的脑子将这些东西会在一觉醒来全 ...
- VC++SDK编程——字体及位置示例
#include <Windows.h> #include <tchar.h> #include <math.h> #define PI 3.1415926 BOO ...
- 【opencv入门篇】快速在VS上配置opencv
环境配置:win7-32 + opencv2.4.6 + vs2013 注意:无论电脑是32位还是64位,配置opencv库目录时选择x84文件夹!因为编译都是使用32位编译:如果选用X64,则程序运 ...
- SDUT2857:艺术联合会(简单dp)
链接: http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2857 题目解析: 这是去年校赛的题目, ...
- oracle dataguard参数
在整个dg配置中,最复杂的也许就是参数的配置了,并且有许多参数都可以延伸出去讲很多,所以今天我们来看看dg的参数配置,顺便加上一点dataguard进程相关的信息,帮助理解. 在配置dg的过程中,我们 ...
- Android 按钮 弹出对话框
ackage com.example.helloworld; import android.os.Bundle;import android.app.Activity;import android.a ...
- hdu4300 Clairewd’s message
地址:http://acm.hdu.edu.cn/showproblem.php?pid=4300 题目: Clairewd’s message Time Limit: 2000/1000 MS (J ...
- 裁剪TOGAF进行产品架构开发
http://ea.zhoujingen.cn/56.html . 有人和我说“周老师,我的企业条件不适合,学习企业架构没用.” 如果等公司让我用企业架构,估计会比我自己开始晚七八年.我们学习任何内容 ...