---
- name: Configure SELinux policy for redis
  when:
    - not remote_redis_server | default(false) | bool
    - squirro_clusternode | default(false) | bool
  block:
    - name: Install redis policy
      ansible.builtin.include_tasks: install_policy.yml
      vars:
        policy_name: redis
    - name: Restart Redis to apply SELinux context changes
      ansible.builtin.service:
        name: "{{ item }}"
        state: restarted
      loop:
        - redis-server
        - redis-server-cache
