---

- name: Check that postfix is installed
  urpmi: name=postfix state=installed no-recommends=yes
  tags: smtp

- name: Copy postfix data files
  copy: src={{ item }} dest=/etc/postfix/{{ item | basename }} owner=root group=root mode=0644 backup=yes
  with_fileglob: [ 'files/{{ smtp_role }}/*' ]
  notify:
    - check and restart postfix
  tags: smtp

- name: Check that postfix is configured
  template: src='templates/main.cf.j2' dest='/etc/postfix/main.cf' owner=root group=root mode=0644 backup=yes
  notify:
    - check and restart postfix
  tags: smtp

- name: Check that postfix is running and enabled
  service: name=postfix state=running enabled=yes
  tags: smtp
