---
- name: Push mail sync script
  template:
    src: mailsync.sh.j2
    dest: /usr/local/bin/mailsync
    mode: 0755
  tags:
    - mailsync

- name: Push mailsync service file
  template:
    src: mailsync.service.j2
    dest: /etc/systemd/user/mailsync.service
  tags:
    - mailsync
  notify:
    - reload systemd config

- name: Push mailsync timer file
  template:
    src: mailsync.timer.j2
    dest: /etc/systemd/user/mailsync.timer
  tags:
    - mailsync
  notify:
    - reload systemd config
    - restart mailsync

- include_tasks: roles/nmtrust/tasks/unit.yml
  vars:
      unit: mailsync.timer
      run_on: "{{ mail.sync_on }}"
      user_unit: true
  tags:
    - mailsync
