---
# tasklist for setting up a SpamAssassin server

- name: install the package
  package: name={{ item }} state=present
  with_items:
  - spamassassin
  - perl-Razor-Agent
  tags:
  - packages

- name: create the specific group
  group: name=spammy system=yes
  tags:
  - config

- name: create the specific user
  user: name=spammy comment="spamassassin user" home=/home/spammy group=spammy createhome=yes system=yes shell=/sbin/nologin
  tags:
  - config

- name: setup the sysconfig file
  copy: src=sysconfig dest=/etc/sysconfig/spamassassin
  notify:
  - restart spamassassin
  tags:
  - config

- name: setup the config file
  copy: src=local.cf dest=/etc/mail/spamassassin/local.cf
  notify:
  - restart spamassassin
  tags:
  - config

- name: setup the cron job
  copy: src=sa-update dest=/etc/cron.d/sa-update
  tags:
  - config

- name: set the service running/enabled
  service: name=spamassassin enabled=true state=started
  tags:
  - service
