千家信息网

salt安装haproxy

发表于:2025-01-22 作者:千家信息网编辑
千家信息网最后更新 2025年01月22日,###################初始化时定义好的包##########################################include: - pkg.pkg-init######
千家信息网最后更新 2025年01月22日salt安装haproxy
###################初始化时定义好的包##########################################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/local/haproxy && make install PREFIX=/usr/local/haproxy    - unless: test -d /usr/local/haproxy    - require:      - pkg: pkg-init      - file: haproxy-installhaproxy-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: 1haproxy-config-dir:  file.directory:    - name: /etc/haproxy    - user: root    - group: root    - mode: 755



########################haproxy-outside.sls######################################include:  - haproxy.installhaproxy-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


#########################top.sls###################################################base:  '*' :    - init.env_initprod:  'web12.limingyu.com':    - cluster.haproxy-outside  'web13.limingyu.com':    - cluster.haproxy-outside


0