---
- name: Install the Redis PPA
  apt_repository: repo='{{ redis_ppa_repo }}' update_cache=yes
  tags: redis

- name: Install the Redis package
  apt: pkg={{ item }} state=present
  with_items: '{{ redis_server_pkg }}'
  tags: redis

- name: Start and enable the Redis service
  service: name=redis-server state=started enabled=yes
  when: redis_enabled
  tags: redis

- name: Stop and disable the Redis service
  service: name=redis-server state=stopped enabled=no
  when: not redis_enabled
  tags: redis