--- - name: Install redis server yum: name=redis state=present - name: Deploy redis configuration template: src=redis.conf.j2 dest=/etc/redis.conf notify: restart redis - name: Deploy pre and post backup hooks copy: src={{ item.script }} dest=/etc/backup/{{ item.hook }}.d/{{ item.script }} mode=755 with_items: - script: 'redis_copy_dumps.sh' hook: pre - script: 'redis_delete_dumps.sh' hook: post - name: Disable redis-sentinel service: name=redis-sentinel state=stopped enabled=no - name: Handle redis port iptables_raw: name: redis_port state: "{{ (redis_src_ip | length > 0) | ternary('present','absent') }}" rules: "-A INPUT -m state --state NEW -p tcp --dport {{ redis_port }} -s {{ redis_src_ip | join(',') }} -j ACCEPT" when: iptables_manage | default(True) - name: Start and enable the service service: name=redis state=started enabled=yes ...