From 3d7d56cdc42bca48e40d6941128f637854da1dfb Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 24 Jul 2019 18:42:26 +0300 Subject: [PATCH] Feat: Use `changed_when` to avoid reporting changes --- playbooks/debian/roles/init-system/tasks/locales.yml | 1 + playbooks/debian/roles/phd/tasks/main.yml | 1 + playbooks/debian/roles/root/tasks/mc.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/playbooks/debian/roles/init-system/tasks/locales.yml b/playbooks/debian/roles/init-system/tasks/locales.yml index 58b7aa7..8143407 100644 --- a/playbooks/debian/roles/init-system/tasks/locales.yml +++ b/playbooks/debian/roles/init-system/tasks/locales.yml @@ -1,6 +1,7 @@ - name: Check locales shell: "grep -c '^ru_RU.KOI8-R' /etc/locale.gen || :" register: has_locales + changed_when: has_locales.stdout == "0" - debug: msg: "Locales have already been configured" diff --git a/playbooks/debian/roles/phd/tasks/main.yml b/playbooks/debian/roles/phd/tasks/main.yml index 9897304..7ab7ba1 100644 --- a/playbooks/debian/roles/phd/tasks/main.yml +++ b/playbooks/debian/roles/phd/tasks/main.yml @@ -2,6 +2,7 @@ command: test -f ~/.profile -a -f ~/.shellrc failed_when: false register: phd_exist + changed_when: phd_exist.rc != 0 - debug: msg: "User phd has already been created" diff --git a/playbooks/debian/roles/root/tasks/mc.yml b/playbooks/debian/roles/root/tasks/mc.yml index 36fe266..655514a 100644 --- a/playbooks/debian/roles/root/tasks/mc.yml +++ b/playbooks/debian/roles/root/tasks/mc.yml @@ -3,6 +3,7 @@ command: test -L ~root/.cache/mc -a -L ~root/.config/mc -a -L ~root/.local/share/mc failed_when: false register: links_exist + changed_when: links_exist.rc != 0 - debug: msg: "mc links have already been created" -- 2.39.5