---
  - name: Install monit
    apt:
      name: monit=1:5.16-2
      state: present
      force: true
    become: true

  - name: Copy sudoers file so that deploy can use monit without entering password.
    copy:
      src: sudoers-monit
      dest: /etc/sudoers.d/monit
    become: true

  - name: Copy monit config to enable http from localhost
    copy:
      src: monit-http.conf
      dest: /etc/monit/conf.d/monit-http.conf
    become: true
    notify:
      - restart_monit

---
  - name: Install monit
    apt:
      name: monit=1:5.16-2
      state: present
      force: true
    become: true
    tags:
      - monit

  - name: Copy sudoers file so that deploy can use monit without entering password.
    copy:
      src: sudoers-monit
      dest: /etc/sudoers.d/monit
    become: true
    tags:
      - monit

  - name: Copy monit config to enable http from localhost
    copy:
      src: monit-http.conf
      dest: /etc/monit/conf.d/monit-http.conf
    become: true
    notify:
      - restart_monit
    tags:
      - monit

Add 'monit' tag to monit tasks
Add 'monit' tag to monit tasks
