From d33701f79bcddd351d7b0d939c575b6b689d9fb0 Mon Sep 17 00:00:00 2001 From: John Helmert III Date: Sun, 19 Nov 2023 15:20:31 -0800 Subject: [PATCH] roles/zfs: don't disable services that aren't there Signed-off-by: John Helmert III --- roles/zfs/tasks/remove.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/zfs/tasks/remove.yml b/roles/zfs/tasks/remove.yml index 6e6311f..77992de 100644 --- a/roles/zfs/tasks/remove.yml +++ b/roles/zfs/tasks/remove.yml @@ -1,10 +1,13 @@ --- +- name: Populate service facts + ansible.builtin.service_facts: - name: Remove zfs cron jobs ansible.builtin.file: path: "/etc/{{ item }}" state: absent with_items: "{{ zfs_cronjobs }}" - name: Stop and disable zfs services + when: item in ansible_facts.services ansible.builtin.service: name: "{{ item }}" state: stopped