saltstack-haproxy安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了saltstack-haproxy安装相关的知识,希望对你有一定的参考价值。
1、创建目录
cd /srv/salt/package
mkdir haproxy
mkdir -p haproxy/files
mkdir -p haproxy/pkg
2、编写依赖包模块
cat pkg/pkg-init.sls
pkg-init:
pkg.installed:
- names:
- gcc
- gcc-c++
- glibc
- make
- autoconf
- openssl
- openssl-devel
- htop
- vim
- lrzsz
3、安装包准备
ls -l haproxy/files
-rw-r--r-- 1 root root 1538976 Nov 23 02:16 haproxy-1.6.2.tar.gz
4、启动脚本获取
在master端
cp haproxy/files/haproxy-1.6.2.tar.gz /usr/local/src/
cd /usr/local/src
tar xvf haproxy-1.6.2.tar.gz
cd haproxy-1.6.2/examples
sed -i ‘s/\/usr\/sbin\/‘\$BASENAME‘/\/usr\/local\/haproxy\/sbin\/‘\$BASENAME‘/g‘ haproxy.init
cp haproxy.init /srv/salt/package/haproxy/files/
5、编写haproxy安装文件
cat /srv/salt/package/haproxy/init.sls
include:
- package.haproxy.pkg.pkg-init
haproxy_source:
file.managed:
- name: /usr/local/src/haproxy-1.6.2.tar.gz
- source: salt://package/haproxy/files/haproxy-1.6.2.tar.gz
- user: root
- group: root
- mode: 755
cmd.run:
- name: cd /usr/local/src && tar zvxf haproxy-1.6.2.tar.gz && cd haproxy-1.6.2 && make TARGET=linux26 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy
- unless: test -d /usr/local/haproxy
- require:
- file: haproxy_source
haproxy_init:
file.managed:
- name: /usr/lib/systemd/system/haproxy.service
- source: salt://package/haproxy/files/haproxy.init
- user: root
- group: root
- mode: 755
haproxy-config-dir:
file.directory:
- name: /etc/haproxy
- user: root
- group: root
- mode: 755
6、入口文件
cat /srv/salt/package/init.sls
include:
- package.http
- package.haproxy
7、执行
salt ‘salt-minion‘ state.sls package.haproxy
那个错误是因为vim已经装过了
8、检查minion端
在master使用salt命令检查:
本文出自 “Linux” 博客,请务必保留此出处http://syklinux.blog.51cto.com/9631548/1893415
以上是关于saltstack-haproxy安装的主要内容,如果未能解决你的问题,请参考以下文章