- name: Check graphite process command: pgrep -f graphite ignore_errors: yes register: graphite_pids - name: Restart Graphite ansible.builtin.service: name: "graphite" state: "restarted" when: graphite_pids.rc == 0