一、yum安装Redis实战
1、yum安装
文件目录:
redis-yum.sls:
redis-install:
pkg.installed:
- name: redis
redis-config:
file.managed:
- name: /etc/redis.conf
- source: salt://redis/files/redis.conf
- user: root
- group: root
- mode: 644
- template: jinja #告诉模板使用jinja
- defaults:
PORT: 6379 #定义的参数
IPADDR: {
{ grains['fqdn_ip4'][0] }} #获取主机ip
redis-service:
service.running:
- name: redis
- enable: True
- restart: True
- watch:
- file: redis-config
测试: