From: Oleg Broytman Date: Mon, 29 Jul 2019 22:58:58 +0000 (+0300) Subject: Feat: Add `changed_when` X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=6d82309ce9774f0e8e31947186740cdaccea6ecc;p=ansible.git Feat: Add `changed_when` --- diff --git a/playbooks/debian/roles/add-apache-vhost/tasks/main.yml b/playbooks/debian/roles/add-apache-vhost/tasks/main.yml index 7a44149..2f0e03a 100644 --- a/playbooks/debian/roles/add-apache-vhost/tasks/main.yml +++ b/playbooks/debian/roles/add-apache-vhost/tasks/main.yml @@ -2,6 +2,7 @@ stat: path: "/etc/apache2/sites-enabled/{{ virtual_host }}.conf" register: vhost_conf + changed_when: not vhost_conf.stat.exists - name: Add vhost import_tasks: add-vhost.yml diff --git a/playbooks/debian/roles/add-dns-domain/tasks/main.yml b/playbooks/debian/roles/add-dns-domain/tasks/main.yml index 422f28e..80f3a6a 100644 --- a/playbooks/debian/roles/add-dns-domain/tasks/main.yml +++ b/playbooks/debian/roles/add-dns-domain/tasks/main.yml @@ -2,6 +2,7 @@ stat: path: "/etc/bind/{{ domain }}" register: domain_exists + changed_when: not domain_exists.stat.exists - name: Copy domain template become: true diff --git a/playbooks/debian/roles/apache/tasks/main.yml b/playbooks/debian/roles/apache/tasks/main.yml index a5b662a..5cd209a 100644 --- a/playbooks/debian/roles/apache/tasks/main.yml +++ b/playbooks/debian/roles/apache/tasks/main.yml @@ -2,6 +2,7 @@ stat: path: /etc/apache2/conf-enabled/001-phd.conf register: phd_conf + changed_when: not phd_conf.stat.exists - debug: msg: "apache has already been configured" diff --git a/playbooks/debian/roles/dehydrated/tasks/main.yml b/playbooks/debian/roles/dehydrated/tasks/main.yml index d43ef8a..87ebe8f 100644 --- a/playbooks/debian/roles/dehydrated/tasks/main.yml +++ b/playbooks/debian/roles/dehydrated/tasks/main.yml @@ -3,6 +3,7 @@ module: stat path: /usr/local/src/LetsEncrypt/dehydrated/.git/config register: dehydrated + changed_when: not dehydrated.stat.exists - name: Install git local_action: