From 6d82309ce9774f0e8e31947186740cdaccea6ecc Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 30 Jul 2019 01:58:58 +0300 Subject: [PATCH] Feat: Add `changed_when` --- playbooks/debian/roles/add-apache-vhost/tasks/main.yml | 1 + playbooks/debian/roles/add-dns-domain/tasks/main.yml | 1 + playbooks/debian/roles/apache/tasks/main.yml | 1 + playbooks/debian/roles/dehydrated/tasks/main.yml | 1 + 4 files changed, 4 insertions(+) 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: -- 2.39.5