码迷,mamicode.com
首页 > 其他好文 > 详细

salt-stack安装redis

时间:2016-05-24 17:10:10      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:redis   saltstack   

    技术分享


install.sls的内容为:

redis-install:

  file.managed:

    - name: /usr/local/src/redis-3.2.0.tar.gz

    - source: salt://redis/files/redis-3.2.0.tar.gz

    - user: root

    - group: root

    - mode: 755

  cmd.run:

    - name: cd /usr/local/src && tar xf redis-3.2.0.tar.gz && cd redis-3.2.0 && make PREFIX=/usr/local/redis install

    - unless: test -d /usr/local/redis

    - require:

      - file: redis-install

 

redis-config:

  cmd.run:

    - name: mkdir /etc/redis

  file.managed:

    - name: /etc/redis/6379.conf

    - source: salt://redis/files/6379.conf

    - user: root

    - group: root

    - mode: 644

 

redis-service:

  file.managed:

    - name: /etc/init.d/redis

    - source: salt://redis/files/redis.init

    - user: root

    - group: root

    - mode: 644

  cmd.run:

    - name: chkconfig --add redis && chkconfig redis on

    - unless: chkconfig --list | grep redis

  service.running:

    - name: redis

    - enable: True

    - watch://在生产环境中此步一定要想清楚,因为redis是内存缓存

      - file: redis-config//watch的作用就是监控的文件变化时,自动重启

    - require:

      - cmd: redis-install

      - cmd: redis-service


本文出自 “激情燃烧的岁月” 博客,请务必保留此出处http://liuzhengwei521.blog.51cto.com/4855442/1782544

salt-stack安装redis

标签:redis   saltstack   

原文地址:http://liuzhengwei521.blog.51cto.com/4855442/1782544

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!