---

- name: Install system monitor daemon
  ansible.builtin.apt:
    name: newrelic-sysmond

- name: Set license key for newrelic-sysmond
  ansible.builtin.replace:
    dest: /etc/newrelic/nrsysmond.cfg
    regexp: "license_key=REPLACE_WITH_REAL_KEY"
    replace: "license_key={{ newrelic_license }}"
  when: newrelic_license | length > 0
  notify: restart newrelic-sysmond
