]> git.phdru.name Git - ansible.git/blobdiff - playbooks/debian/roles/apache/tasks/main.yml
Feat: Use module `stat` instead of command `test`
[ansible.git] / playbooks / debian / roles / apache / tasks / main.yml
index f0481d91e1c0a80fcef3672125f20fc8d3602edd..b289d9419d2223378b721663adca2ff167b6c2dd 100644 (file)
@@ -1,12 +1,11 @@
 - name: Check apache
-  command: test -L /etc/apache2/conf-enabled/001-phd.conf
-  failed_when: false
-  register: apache
-  changed_when: apache.rc != 0
+  stat:
+    path: /etc/apache2/conf-enabled/001-phd.conf
+  register: phd_conf
 
 - debug:
     msg: "apache has already been configured"
-  when: apache.rc == 0
+  when: not phd_conf.stats.exists
 
 - name: Install apache
   become: true
     purge: yes
     state: latest
     update_cache: yes
-  when: apache.rc != 0
+  when: not phd_conf.stats.exists
 
 - name: Enable SSL module
   become: true
   command: a2enmod ssl
   notify: Reload apache
-  when: apache.rc != 0
+  when: not phd_conf.stats.exists
 
 - name: Configure apache
   become: true
     group: root
     mode: '0640'
     force: no
-  when: apache.rc != 0
+  when: not phd_conf.stats.exists
 
 - name: Enable config
   become: true
   command: a2enconf 001-phd
   notify: Reload apache
-  when: apache.rc != 0
+  when: not phd_conf.stats.exists
 
 - name: Configure logrotate
   become: true