- name: postmap all files
  tags: always
  become: true
  command: postmap /etc/postfix/{{ item }}
  listen: postmap all files
  with_items:
    - "sender_whitelist"
    #- "recipient_whitelist"
    #- "recipient_whitelist_before_blacklists"
    #- "recipient_ip_whitelist_4_greylisting"
    #- "recipient_ip_client_whitelist"
    - "sender_perfact"
  notify: reload postfix.service

- name: postalias all files
  listen: postalias all files
  tags: always
  become: true
  command: postalias /etc/{{ item }}
  with_items:
    - aliases
    - postfix/virtual_aliases
  notify: reload postfix.service

- name: restart postfix.service
  listen: restart postfix.service
  tags: always
  become: true
  service:
    name: postfix
    state: restarted

- name: reload postfix.service
  listen: reload postfix.service
  tags: always
  become: true
  service:
    name: postfix
    state: reloaded

- name: Restart Monit
  tags: always
  become: true
  service:
    name: monit.service
    state: restarted
  listen: "restart monit"
