Salt-stack install redis
The content of install.sls is:
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:// must think carefully about this step in a production environment, because redis is an in-memory cache
-file: the function of redis-config//watch is to restart automatically when a file changes.
-require:
-cmd: redis-install
-cmd: redis-service