salt安装haproxy

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###################初始化时定义好的包##########################################
include:
   - pkg.pkg-init
 
###################HAPROXY安装###########################################
haproxy- install :
   file .managed:
     - name:  /usr/local/src/haproxy-1 .7.2. tar .gz
     source : salt: //haproxy/files/haproxy-1 .7.2. tar .gz
     - user: root
     - group: root
     - mode: 755
   cmd.run:
     - name:  cd  /usr/local/src/  &&  tar  zxf haproxy-1.7.2. tar .gz &&  cd  haproxy-1.7.2 &&  make  TARGET=linux26 PREFIX= /usr/loc
al /haproxy  &&  make  install  PREFIX= /usr/local/haproxy
     - unless:  test  -d  /usr/local/haproxy
     - require:
       - pkg: pkg-init
       file : haproxy- install
 
 
haproxy-init:
   file .managed:
     - name:  /etc/init .d /haproxy
     source : salt: //haproxy/files/haproxy .init
     - user: root
     - group: root
     - mode: 755
     - require:
       - cmd: haproxy- install
   cmd.run:
     - name: chkconfig --add haproxy
     - unless: chkconfig --list | grep  haproxy
     - require:
       file /etc/init .d /haproxy
       
       
net.ipv4.ip_nonlocal_bind:
   sysctl.present:
     - value: 1
 
 
haproxy-config- dir :
   file .directory:
     - name:  /etc/haproxy
     - user: root
     - group: root
     - mode: 755



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
########################haproxy-outside.sls######################################
 
include:
   - haproxy. install
 
 
haproxy-service:
   file .managed:
     - name:  /etc/haproxy/haproxy .cfg
     source : salt: //cluster/files/haproxy-outside .cfg
     - user: root
     - group: root
     - mode: 644
   cmd.run:
     - name:  useradd  -s  /sbin/nologin  haproxy
     - onlyif:  id  haproxy| echo  $?
   service.running:
     - name: haproxy
     enable : True
     - reload: True
     - require:
       - cmd: haproxy-init
     watch :
       file : haproxy-service


1
2
3
4
5
6
7
8
9
10
11
12
13
#########################top.sls###################################################
 
 
base:
   '*'  :
     - init.env_init
 
 
prod:
   'web12.limingyu.com' :
     - cluster.haproxy-outside
   'web13.limingyu.com' :
     - cluster.haproxy-outside



      本文转自limingyu0312  51CTO博客,原文链接:http://blog.51cto.com/limingyu/1910875,如需转载请自行联系原作者



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值