- name: Install dansguardian package
  package:
    name: dansguardian
    state: present
  tags:
    - download

- name: Install /etc/dansguardian/dansguardian.conf from template (Fedora)
  template:
    src: roles/network/templates/squid/dansguardian.conf.j2
    dest: /etc/dansguardian/dansguardian.conf
    owner: dansguardian
    group: dansguardian
    mode: 0640
  when: ansible_distribution == "Fedora"

- name: Install /etc/dansguardian/dansguardian.conf from template (debuntu)
  template:
    src: roles/network/templates/squid/dansguardian.conf.debian.j2
    dest: /etc/dansguardian/dansguardian.conf
    owner: dansguardian
    group: dansguardian
    mode: 0640
  when: is_debuntu | bool

- name: Install /etc/dansguardian/dansguardian.conf from template (CentOS)
  template:
    src: roles/network/templates/squid/dansguardian.conf.centos.j2
    dest: /etc/dansguardian/dansguardian.conf
    owner: dansguardian
    group: vscan
    mode: 0640
  when: ansible_distribution == "CentOS"

- name: Create directory /var/log/dansguardian (OS's other than CentOS)
  file:
    path: /var/log/dansguardian
    owner: dansguardian
    group: dansguardian
    mode: 0750
    state: directory
  when: ansible_distribution != "CentOS"

- name: Create directory /var/log/dansguardian (CentOS)
  file:
    path: /var/log/dansguardian
    owner: dansguardian
    group: vscan
    mode: 0750
    state: directory
  when: ansible_distribution == "CentOS"
