From: Oleg Broytman Date: Sun, 28 Jul 2019 19:01:09 +0000 (+0300) Subject: Feat: Add `changed_when` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9c7776a3c9b2c701f80c06954a9b1a975b68d843;p=ansible.git Feat: Add `changed_when` --- diff --git a/playbooks/debian/roles/phd/tasks/main.yml b/playbooks/debian/roles/phd/tasks/main.yml index 2c7373c..dfd8780 100644 --- a/playbooks/debian/roles/phd/tasks/main.yml +++ b/playbooks/debian/roles/phd/tasks/main.yml @@ -2,6 +2,7 @@ stat: path: "{{ item }}" register: phd_exists + changed_when: not phd_exists.stat.exists loop: ['~/.profile', '~/.shellrc'] - debug: diff --git a/playbooks/debian/roles/root/tasks/mc.yml b/playbooks/debian/roles/root/tasks/mc.yml index ec80523..332015e 100644 --- a/playbooks/debian/roles/root/tasks/mc.yml +++ b/playbooks/debian/roles/root/tasks/mc.yml @@ -3,6 +3,7 @@ stat: path: "{{ item }}" register: links_exist + changed_when: not links_exist.stat.exists loop: ['~root/.cache/mc', '~root/.config/mc', '~root/.local/share/mc'] - debug: diff --git a/playbooks/debian/roles/root/tasks/root.yml b/playbooks/debian/roles/root/tasks/root.yml index b713f01..142e00c 100644 --- a/playbooks/debian/roles/root/tasks/root.yml +++ b/playbooks/debian/roles/root/tasks/root.yml @@ -44,6 +44,7 @@ stat: path: ~root/.sh_history register: sh_history + changed_when: not sh_history.stat.exists - name: "Setup ~root - create .sh_history" become: true