saltstack二
配置管理
haproxy的安装部署
haproxy各版本安装包下载路径https://www.haproxy.org/download/1.6/src/,跳转地址为http,改为https即可
创建相关目录
# 创建配置目录
[root@linux-node1 ~]# mkdir /srv/salt/prod/pkg/
[root@linux-node1 ~]# mkdir /srv/salt/prod/haproxy/
# 启动脚本、配置文件放在这里
[root@linux-node1 ~]# mkdir /srv/salt/prod/haproxy/files
编写pkg-init文件
[root@linux-node1 ~]# cd /srv/salt/prod/pkg/
[root@linux-node1 pkg]# vim pkg-init.sls
pkg-init: # ID describe
pkg.installed: # pkg模块 installed方法
- names:
- gcc
- gcc-c++
- glibc
- make
- autoconf
- openssl
- openssl-devel
编写方法:
首先自己先安装一遍,然后将步骤移植到sls文件中。
[root@linux-node1 prod]# cd /srv/salt/prod/haproxy/files/
[root@linux-node1 files]# ll
-rw-r--r-- root root 11月 : haproxy-1.6..tar.gz
[root@linux-node1 files]# cp haproxy-1.6..tar.gz /usr/local/src/
[root@linux-node1 files]# cd /usr/local/src/
[root@linux-node1 src]# tar zxf haproxy-1.6..tar.gz
[root@linux-node1 src]# cd haproxy-1.6.
[root@linux-node1 haproxy-1.6.]# make TARGET=linux26 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy
修改启动文件
[root@linux-node1 examples]# pwd
/usr/local/src/haproxy-1.6./examples
[root@linux-node1 examples]# vim haproxy.init
BIN=/usr/local/haproxy/sbin/$BASENAME
# 拷贝启动文件到salt目录
[root@linux-node1 examples]# cp haproxy.init /srv/salt/prod/haproxy/files/
编写安装文件
[root@linux-node1 examples]# cd /srv/salt/prod/haproxy/
[root@linux-node1 haproxy]# vim install.sls include: # 导入pkg目录下的pkg-init.sls文件
- pkg.pkg-init haproxy-install: # 定义声明一个ID,方便调用,如果不写,就必须在这儿写上下面name声明,表文件路径
file.managed: # file模块下的managed方法
- name: /usr/local/src/haproxy-1.6..tar.gz # name声明,文件路径。说明:minion端是没有这个路径和文件的,但是它会从下面source路径将文件拷贝到该路径,没有文件夹就创建
- source: salt://haproxy/files/haproxy-1.6.2.tar.gz # 文件源,minion端从这里拷贝
- user: root # 用户
- group: root # 组
- mode: # 权限
cmd.run: # 执行命令
- name: cd /usr/local/src/ && tar zxf haproxy-1.6..tar.gz && cd haproxy-1.6. && make TARGET=linux26 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy
- unless: test -d /usr/local/haproxy # 判断是否存在,unless返回值是false时,才执行命令
- require: # 依赖下面的内容
- pkg: pkg-init # pkg是模块
- file: haproxy-install # file也是模块 格式: - 模块: ID 依赖文件如果有ID声明就写ID声明,如果没有就写name声明 haproxy-init: # 定义声明一个ID
file.managed:
- name: /etc/init.d/haproxy
- source: salt://haproxy/files/haproxy.init #修改启动文件并将其放入该目录
- user: root
- group: root
- mode:
- require:
- cmd: haproxy-install
cmd.run:
- name: chkconfig --add haproxy
- unless: chkconfig --list |grep haproxy
- require:
- file: haproxy-init net.ipv4.ip_nonlocal_bind: # 定义声明一个ID
sysctl.present: # 修改系统的kernel值
- value: # 改值为1 haproxy-config-dir:
file.directory:
- name: /etc/haproxy
- user: root
- group: root
- mode:
查看安装文件并执行
[root@linux-node1 haproxy]# pwd
/srv/salt/prod/haproxy
[root@linux-node1 haproxy]# tree
.
├── files
│ ├── haproxy-1.6..tar.gz
│ └── haproxy.init
└── install.sls
# 单个执行,另外需要指定环境是prod,不指定默认为base
[root@linux-node1 haproxy]# salt 'linux-node1.*' state.sls haproxy.install saltenv='prod'
注意上面的saltenv对应的master配置文件为
file_roots:
base:
- /srv/salt/base
test:
- /srv/salt/test
dev:
- /srv/salt/dev/services
- /srv/salt/dev/states
prod:
- /srv/salt/prod
编辑配置文件
# 编辑top文件
[root@linux-node1 cluster]# cd /srv/salt/base/
[root@linux-node1 base]# vim top.sls
base:
'*':
- init.env_init
prod:
'linux-node1.example.com':
- cluster.haproxy-outside
'linux-node2.example.com':
- cluster.haproxy-outside
修改后端RS的端口
[root@linux-node1 base]# vim /etc/httpd/conf/httpd.conf
# 端口改成8080,与上面haproxy的配置一样
测试通过后,执行高级状态
[root@linux-node1 base]# salt '*' state.highstate test=True
[root@linux-node1 base]# salt '*' state.highstate
在RS上设置index.html
分别色设置,没有的话会报错403
[root@linux-node2 ~]# vim /var/www/html/index.html
访问haproxy的状态
# 用户名密码在haproxy-outside.cfg中配置
keepalived的安装部署
首先自己安装一次
[root@linux-node1 base]# cd /usr/local/src
[root@linux-node1 src]# wget http://www.keepalived.org/software/keepalived-1.2.19.tar.gz
[root@linux-node1 src]# tar zxf keepalived-1.2..tar.gz
[root@linux-node1 src]# cd keepalived-1.2.
[root@linux-node1 keepalived-1.2.]# ./configure --prefix=/usr/local/keepalived --disable-fwmark
[root@linux-node1 keepalived-1.2.]# make && make install
建立文件放置目录
[root@linux-node1 etc]# pwd
/usr/local/src/keepalived-1.2./keepalived/etc
[root@linux-node1 etc]# mkdir /srv/salt/prod/keepalived/
[root@linux-node1 etc]# mkdir /srv/salt/prod/keepalived/files
[root@linux-node1 etc]# cp init.d/keepalived.init /srv/salt/prod/keepalived/files/
[root@linux-node1 etc]# cp keepalived/keepalived.conf /srv/salt/prod/keepalived/files/
[root@linux-node1 etc]# cp /usr/local/src/keepalived-1.2..tar.gz /srv/salt/prod/keepalived/files/
[root@linux-node1 init.d]# cp /usr/local/src/keepalived-1.2./keepalived/etc/init.d/keepalived.sysconfig /srv/salt/prod/keepalived/files/
# files中的文件有
[root@linux-node1 sysconfig]# cd /srv/salt/prod/keepalived/files/
[root@linux-node1 files]# ll
总用量
-rw-r--r-- root root 1月 : keepalived-1.2..tar.gz
-rw-r--r-- root root 1月 : keepalived.conf
-rwxr-xr-x root root 1月 : keepalived.init
-rw-r--r-- root root 1月 : keepalived.sysconfig
修改启动脚本
[root@linux-node1 files]# vim keepalived.init
daemon /usr/local/keepalived/sbin/keepalived ${KEEPALIVED_OPTIONS}
编辑安装文件
[root@linux-node1 keepalived]# pwd
/srv/salt/prod/keepalived
[root@linux-node1 keepalived]# cat install.sls
include:
- pkg.pkg-init keepalived-install:
file.managed:
- name: /usr/local/src/keepalived-1.2..tar.gz
- source: salt://keepalived/files/keepalived-1.2.19.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf keepalived-1.2..tar.gz && cd keepalived-1.2. && ./configure --prefix=/usr/local/keepalived --disable-fwmark && make && make install && ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin
- unless: test -d /usr/local/keepalived
- require:
- pkg: pkg-init
- file: keepalived-install keepalived-init:
file.managed:
- name: /etc/init.d/keepalived
- source: salt://keepalived/files/keepalived.init
- user: root
- group: root
- mode:
cmd.run:
- name: chkconfig --add keepalived
- unless: chkconfig --list | grep keepalived
- require:
- file: keepalived-init /etc/sysconfig/keepalived:
file.managed:
- source: salt://keepalived/files/keepalived.sysconfig
- user: root
- group: root
- mode: keepalived-config: //配置文件这块在这儿只是举个例子,实际是在下面单独配置修改(因为在实际应用中,每个keepalived的配置文件都不相同,这里就需要用到jinja对应传参)
file.managed:
- name: /etc/keepalived/keepalived.conf
- source: salt://keepalived/files/keepalived.conf
- user: root
- group: root
- mode: /etc/keepalived:
file.directory:
- user: root
- group: root
- mode:
执行安装
[root@linux-node1 keepalived]# salt '*' state.sls keepalived.install env=prod
业务模块
keepalived的配置文件
[root@linux-node1 ~]# cd /srv/salt/prod/cluster/files/
[root@linux-node1 files]# vim haproxy-outside-keepalived.conf ! Configuration File for keepalived
global_defs {
notification_email {
saltstack@example.com
}
notification_email_from keepalived@example.com
smtp_server 127.0.0.1
smtp_connect_timeout
router_id {{ROUTEID}}
} vrrp_instance haproxy_ha {
state {{STATEID}}
interface eth0
virtual_router_id
priority {{PRIORITYID}}
advert_int
authentication {
auth_type PASS
auth_pass
}
virtual_ipaddress {
10.0.0.11 # 这个VIP在haproxy的配置文件中也有
}
}
keepalived的启动文件
其中定义了上面需要的变量,用到了jinja模版
[root@linux-node1 cluster]# cd /srv/salt/prod/cluster/
[root@linux-node1 cluster]# vim haproxy-outside-keepalived.sls
include:
- keepalived.install keepalived-service:
file.managed:
- name: /etc/keepalived/keepalived.conf
- source: salt://cluster/files/haproxy-outside-keepalived.conf
- user: root
- group: root
- mode:
- template: jinja
{% if grains['fqdn'] == 'linux-node1.example.com' %}
- ROUTEID: haproxy_ha //格式 变量: 值
- STATEID: MASTER
- PRIORITYID:
{% elif grains['fqdn'] == 'linux-node2.example.com' %}
- ROUTEID: haproxy_ha
- STATEID: BACKUP
- PRIORITYID:
{% endif %} service.running:
- name: keepalived
- enable: True
- watch:
- file: keepalived-service
注:require依赖监听软件包是否安装(没有安装就安装),watch是监听文件是否发生改变(发生改变就执行相应功能,如上例则为:监听文件改变,如果改变就重启服务)
编辑top文件
[root@linux-node1 base]# cd /srv/salt/base/
[root@linux-node1 base]# cat top.sls
base:
'*':
- init.env_init
prod:
'linux-node1.example.com':
- cluster.haproxy-outside
- cluster.haproxy-outside-keepalived //配置sls文件,其中include有keepalived.install,即执行该配置sls文件即可执行keepalived安装sls
'linux-node2.example.com':
- cluster.haproxy-outside
- cluster.haproxy-outside-keepalived
执行高级状态
先单独执行下,看有没有错误在执行高级状态
[root@linux-node1 cluster]# salt '*' state.sls cluster.haproxy-outside-keepalived env=prod
[root@linux-node1 cluster]# salt '*' state.highstate
查看结果
[root@linux-node1 base]# ip a |grep eth0
: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP qlen
inet 10.0.0.7/ brd 10.0.0.255 scope global eth0
inet 10.0.0.11/ scope global eth0 当master的keepaliveddown掉后,VIP会飘到backup上
haproxy的调度设置
[root@linux-node1 base]# grep "balance" /srv/salt/prod/cluster/files/haproxy-outside.cfg
balance roundrobin #轮询;source:固定不变 可以在haproxy-status页面上查看到变化
如图
zabbix-agent的安装部署
开启pillar
[root@linux-node1 init]# vim /etc/salt/master
pillar_roots:
base:
- /srv/pillar/base [root@linux-node1 init]# mkdir /srv/pillar/base
[root@linux-node1 init]# /etc/init.d/salt-master restart
Stopping salt-master daemon: [确定]
Starting salt-master daemon: [确定]
编写zabbix-agent安装文件
[root@linux-node1 base]# cd /srv/salt/base/init/
[root@linux-node1 init]# vim zabbix_agent.sls
zabbix-agent-install:
pkg.installed:
- name: zabbix-agent
file.managed:
- name: /etc/zabbix/zabbix_agentd.conf
- source: salt://init/files/zabbix_agentd.conf
- template: jinja
- defaults:
Server: {{ pillar['zabbix-agent']['Zabbix_Server'] }}
- require:
- pkg: zabbix-agent-install
service.running:
- name: zabbix-agent
- enable: True
- watch:
- pkg: zabbix-agent-install
- file: zabbix-agent-install
编写top文件
[root@linux-node1 base]# cd /srv/pillar/base/
[root@linux-node1 base]# vim top.sls
base:
'*':
- zabbix
编写zabbix.sls
[root@linux-node1 base]# vim zabbix.sls
zabbix-agent:
Zabbix_Server: 10.0.0.7
这里对应上面Server: {{ pillar['zabbix-agent']['Zabbix_Server'] }}
配置文件拷贝修改
[root@linux-node1 base]# cd /srv/salt/base/init/files
[root@linux-node1 init]# cp /etc/zabbix/zabbix_agentd.conf . [root@linux-node1 init]# grep 'Server' zabbix_agentd.conf
Server={{ Server }} # 对应上面zabbix_agent.sls中的server
编辑env_init文件
[root@linux-node1 init]# vim env_init.sls
include:
- init.dns
- init.history
- init.audit
- init.sysctl
- init.zabbix_agent
[root@linux-node1 init]# tree /srv/salt/base/init/
/srv/salt/base/init/
├── audit.sls
├── dns.sls
├── env_init.sls
├── files
│ ├── resolv.conf
│ └── zabbix_agentd.conf
├── history.sls
├── sysctl.sls
└── zabbix_agent.sls
另外epel的sls文件
[root@linux-node1 init]# vim epel.sls yum_repo_release:
pkg.installed:
- sources:
- epel-release: http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
- unless: rpm -qa | grep epel-release--
安装libevent
[root@linux-node1 ~]# cd /srv/salt/prod/
[root@linux-node1 prod]# mkdir -pv libevent/files
[root@linux-node1 prod]# cd /srv/salt/prod/libevent
[root@linux-node1 libevent]# vim install.sls
libevent-source-install:
file.managed:
- name: /usr/local/src/libevent-2.0.-stable.tar.gz
- source: salt://libevent/files/libevent-2.0.22-stable.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf libevent-2.0.-stable.tar.gz && cd libevent-2.0.-stable && ./configure --prefix=/usr/local/libevent && make && make install
- unless: test -d /usr/local/libevent
- require:
- file: libevent-source-install [root@linux-node1 libevent]# pwd
/srv/salt/prod/libevent
[root@linux-node1 libevent]# tree
.
├── files
│ └── libevent-2.0.-stable.tar.gz
└── install.sls [root@linux-node1 files]# salt '*' state.sls libevent.install env=prod
[root@linux-node1 files]# salt '*' state.highstate
新建用户,且不允许登录
[root@linux-node1 prod]# mkdir user
[root@linux-node1 prod]# cd user/
[root@linux-node1 user]# vim www.sls
www-user-group:
group.present:
- name: www
- gid:
user.present:
- name: www
- fullname: www
- shell: /sbin/nologin
- uid:
- gid:
安装memcahe
[root@linux-node1 prod]# cd /srv/salt/prod/
[root@linux-node1 prod]# mkdir -p memcache/files
[root@linux-node1 prod]# cd memcache/files/
[root@linux-node1 files]# cp memcached-1.4..tar.gz /usr/local/src/ [root@linux-node1 memcache]# vim install.sls
include:
- libevent.install # 将libevent文件包含进来 memcached-source-install:
file.managed:
- name: /usr/local/src/memcached-1.4..tar.gz
- source: salt://memcached/files/memcached-1.4.24.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf memcached-1.4..tar.gz && cd memcached-1.4.&& ./configure --prefix=/usr/local/memcached --enable-64bit --with-libevent=/usr/local/libevent && make && make install
- unless: test -d /usr/local/memcached
- require:
- cmd: libevent-source-install # libevent的ID
- file: memcached-source-install
安装pcre
[root@linux-node1 prod]# mkdir /srv/salt/prod/pcre/files -p
[root@linux-node1 prod]# cd /srv/salt/prod/pcre/files/
[root@linux-node1 files]# cp pcre-8.37.tar.gz /usr/local/src/
[root@linux-node1 prod]# cd /srv/salt/prod/pcre
[root@linux-node1 pcre]# cat install.sls
pcre-source-install:
file.managed:
- name: /usr/local/src/pcre-8.37.tar.gz
- source: salt://pcre/files/pcre-8.37.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf pcre-8.37.tar.gz && cd pcre-8.37 && ./configure --prefix=/usr/local/pcre && make && make install
- unless: test -d /usr/local/pcre
- require:
- file: pcre-source-install
安装nginx
[root@linux-node1 nginx]# mkdir -p /srv/salt/prod/nginx/files
[root@linux-node1 nginx]# cd /srv/salt/prod/nginx/files/
[root@linux-node1 files]# cp nginx-1.9..tar.gz /usr/local/src/
[root@linux-node1 nginx]# cat install.sls
include:
- pcre.install
- user.www
- pkg.pkg-init
nginx-source-install:
file.managed:
- name: /usr/local/src/nginx-1.9..tar.gz
- source: salt://nginx/files/nginx-1.9.1.tar.gz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf nginx-1.9..tar.gz && cd nginx-1.9.&& ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-http_dav_module --with-pcre=/usr/local/src/pcre-8.37 && make && make install && chown -R www:www /usr/local/nginx
- unless: test -d /usr/local/nginx
- require:
- user: www-user-group
- file: nginx-source-install
- pkg: pkg-init
- cmd: pcre-source-install [root@linux-node1 nginx]# cat service.sls
include:
- nginx.install nginx-init:
file.managed:
- name: /etc/init.d/nginx
- source: salt://nginx/files/nginx-init
- mode:
- user: root
- group: root
cmd.run:
- name: chkconfig --add nginx
- unless: chkconfig --list | grep nginx
- require:
- file: nginx-init /usr/local/nginx/conf/nginx.conf:
file.managed:
- source: salt://nginx/files/nginx.conf
- user: www
- group: www
- mode: nginx-service:
file.directory:
- name: /usr/local/nginx/conf/vhost
- require:
- cmd: nginx-source-install
service.running:
- name: nginx
- enable: True
- reload: True
- require:
- cmd: nginx-init
- watch:
- file: /usr/local/nginx/conf/nginx.conf [root@linux-node1 nginx]# tree
.
├── files
│ ├── nginx-1.9..tar.gz
│ ├── nginx.conf
│ └── nginx-init
├── install.sls
└── service.sls
PHP+memcahce/redis的安装
基础环境
[root@linux-node1 ~]# mkdir /srv/salt/prod/php/files -p
[root@linux-node1 ~]# cd /srv/salt/prod/php/files/
[root@linux-node1 files]# ll
总用量
-rw-r--r-- root root 11月 : init.d.php-fpm
-rw-r--r-- root root 11月 : memcache-2.2..tgz
-rw-r--r-- root root 11月 : php-5.6..tar.gz
-rw-r--r-- root root 11月 : php-fpm.conf.default
-rw-r--r-- root root 11月 : php.ini-production
-rw-r--r-- root root 11月 : redis-2.2..tgz
安装文件
[root@linux-node1 files]# cd ..
[root@linux-node1 php]# vim install.sls
pkg-php:
pkg.installed:
- names:
- mysql-devel
- openssl-devel
- swig
- libjpeg-turbo
- libjpeg-turbo-devel
- libpng
- libpng-devel
- freetype
- freetype-devel
- libxml2
- libxml2-devel
- zlib
- zlib-devel
- libcurl
- libcurl-devel php-source-install:
file.managed:
- name: /usr/local/src/php-5.6..tar.gz
- source: salt://php/files/php-5.6.9.tar.gz
- user: root
- group: root
- mode: cmd.run:
- name: cd /usr/local/src && tar zxf php-5.6..tar.gz && cd php-5.6.&& ./configure --prefix=/usr/local/php-fastcgi --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --with-libxml-dir --with-curl --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --with-openssl --enable-mbstring --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/lib64 --with-gettext=/usr/lib64 --enable-sockets --with-xmlrpc --enable-zip --enable-soap --disable-debug --enable-opcache --enable-zip --with-config-file-path=/usr/local/php-fastcgi/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www && make && make install
- require:
- file: php-source-install
- user: www-user-group
- unless: test -d /usr/local/php-fastcgi pdo-plugin:
cmd.run:
- name: cd /usr/local/src/php-5.6./ext/pdo_mysql/ && /usr/local/php-fastcgi/bin/phpize && ./configure --with-php-config=/usr/local/php-fastcgi/bin/php-config && make&& make install
- unless: test -f /usr/local/php-fastcgi/lib/php/extensions/*/pdo_mysql.so
- require:
- cmd: php-source-install php-ini:
file.managed:
- name: /usr/local/php-fastcgi/etc/php.ini
- source: salt://php/files/php.ini-production
- user: root
- group: root
- mode: 644 php-fpm:
file.managed:
- name: /usr/local/php-fastcgi/etc/php-fpm.conf
- source: salt://php/files/php-fpm.conf.default
- user: root
- group: root
- mode: 644 php-fastcgi-service:
file.managed:
- name: /etc/init.d/php-fpm
- source: salt://php/files/init.d.php-fpm
- user: root
- group: root
- mode: 755
cmd.run:
- name: chkconfig --add php-fpm
- unless: chkconfig --list | grep php-fpm
- require:
- file: php-fastcgi-service
service.running:
- name: php-fpm
- enable: True
- require:
- cmd: php-fastcgi-service
- watch:
- file: php-ini
- file: php-fpm
memcache
[root@linux-node1 php]# cat php-memcache.sls
memcache-plugin:
file.managed:
- name: /usr/local/src/memcache-2.2..tgz
- source: salt://php/files/memcache-2.2.7.tgz
- user: root
- group: root
- mode: cmd.run:
- name: cd /usr/local/src && tar zxf memcache-2.2..tgz && cd memcache-2.2.&& /usr/local/php-fastcgi/bin/phpize && ./configure --enable-memcache --with-php-config=/usr/local/php-fastcgi/bin/php-config && make&& make install
- unless: test -f /usr/local/php-fastcgi/lib/php/extensions/*/memcache.so
require:
- file: memcache-plugin
- cmd: php-install /usr/local/php-fastcgi/etc/php.ini:
file.append:
- text:
- extension=memcache.so
redis
[root@linux-node1 php]# cat php-redis.sls
redis-plugin:
file.managed:
- name: /usr/local/src/phpredis-2.2..tgz
- source: salt://php/files/phpredis-2.2.7.tgz
- user: root
- group: root
- mode:
cmd.run:
- name: cd /usr/local/src && tar zxf phpredis-2.2..tgz && cd phpredis-2.2.&& /usr/local/php-fastcgi/bin/phpize && ./configure --with-php-config=/usr/local/php-fastcgi/bin/php-config && make&& make install
- unless: test -f /usr/local/php-fastcgi/lib/php/extensions/*/redis.so
require:
- file: redis-plugin
- cmd: php-install /usr/local/php-fastcgi/etc/php.ini:
file.append:
- text:
- extension=redis.so
出处:http://www.cnblogs.com/caoxiaojian/
saltstack二的更多相关文章
- saltstack自动化运维系列⑩SaltStack二次开发初探
saltstack自动化运维系列⑩SaltStack二次开发初探 1.当salt运行在公网或者网络环境较差的条件下,需要配置timeout时间vim /etc/salt/master timeout: ...
- saltstack二次开发(一)
Saltstack简介 Salt是一个配置管理系统,能够维护预定义状态的远程节点(比如,确保指定的包被安装,指定的服务在运行),一个分布式远程执行系统,用来在远程节点(可以是单个节点,也可以是任意规则 ...
- python之saltstack二次开发
一.salt的概念 salt是一个配置管理系统,能够维护预定义状态的远程节点(比如,确保指定的报被安装,指定的服务在运行).一个分布式远程执行系统,用来在远程节点(可以是单个节点,也可以是任意规则挑选 ...
- saltstack二次开发(三)
以下代码实现的功能: 通过saltstack的httpapi在minion上安装软件. vim saltapi.py #!/usr/bin/env python # -*- coding: utf-8 ...
- saltstack二次开发(二)
Saltstack的api Salt-api有两种方式,一种是函数的形式,有人家定义好的函数,我们可以直接调用,直接写python代码调用函数或者类就可以了.第二种形式是salt-api有封装好的ht ...
- saltstack(二) master、minion常用配置选项
master常用配置选项: interface: 指定bind的地址(默认0.) publish_port:指定发布端口(默认4505) ret_port: 指定结果返回端口,与minion配置文件的 ...
- saltstack系列~第二篇
一 简介:今天咱们来继续学习saltstack 二 命名和分组 1 命名规则 1 ID构成 机房-DB类型-角色(主/从)-IP地址 2 分组构成 分为master slave两组即可 2 分组规则 ...
- saltstack系列~第一篇
一 简介:从今天开始学习saltstack 二 salt的认证系列操作 1 原理 saltstack通过/etc/salt/pki/目录下面的配置文件的密钥进行通信,master端接受minion端后 ...
- saltstack集合
saltstack集合 saltstack(一): saltstack简介 saltstack(二): saltstack安装及配置 saltstack(三): saltstack远程执行 ...
随机推荐
- 3、原生jdbc链接数据库之锁与事务
一.锁的概念1.作用:是保证数据的一致性,只能一个人修改数据,不能同时多用户修改2.分类:行级锁和表级锁 乐观锁和悲观锁 二.事务1.为了保证数据的一致性和完整性,让数据库的多项操作合并为一个整体 ...
- 10 python 初学(Python 的编码解码)
Python 2 : ASCII Python 3 :Unicode
- .Net使用Redis详解之ServiceStack.Redis(七) 转载https://www.cnblogs.com/knowledgesea/p/5032101.html
.Net使用Redis详解之ServiceStack.Redis(七) 序言 本篇从.Net如何接入Reis开始,直至.Net对Redis的各种操作,为了方便学习与做为文档的查看,我做一遍注释展现 ...
- 两个数字比较大小的方法 (分别应用if-else和条件运算符实现)
package com.Summer_0424.cn; /** * @author Summer * 两个数字比较大小的方法 * 分别应用if-else和条件运算符实现 */ public class ...
- 解决git commit 大文件推送失败
//查找大文件 git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -g | tail -5 //根据上面查找到的hash值,筛选文 ...
- oracle expdp导出时报 ora-39070:无法打开日志文件
在通过expdp导出命令导出某个用户的对象时出现以下截图错误: ORA-39002:操作无效 ORA-39070:无法打开日志文件 ORA-39087:目录名<directory>无效 该 ...
- 个人博客添加网易云音乐Flash插件
博客底部添加网易云音乐播放插件 歌单或者歌曲外链可从音乐界面"生成外链播放器"中得到,选择Flash播放插件即可 footer.html文件增加 实现效果: 历史精选文章: Jli ...
- ML.NET 示例:推荐之One Class 矩阵分解
写在前面 准备近期将微软的machinelearning-samples翻译成中文,水平有限,如有错漏,请大家多多指正. 如果有朋友对此感兴趣,可以加入我:https://github.com/fei ...
- Web登录其实没那么简单
1. 一个简单的HTML例子看看用户信息安全 标准的HTML语法中,支持在form表单中使用<input></input>标签来创建一个HTTP提交的属性,现代的WEB登录中, ...
- linux下的shell脚本(基本)
shell有些命令和格式不用老是容易忘,学而时习之,不亦说乎~ 先说明以下内容来自: http://c.biancheng.net/cpp/shell/ ,C语言中文网,请大家支持原作,点击链接查看. ...