- 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: phd_conf.stat.exists
- name: Install apache
become: true
purge: yes
state: latest
update_cache: yes
- when: apache.rc != 0
+ when: not phd_conf.stat.exists
- name: Enable SSL module
become: true
command: a2enmod ssl
notify: Reload apache
- when: apache.rc != 0
+ when: not phd_conf.stat.exists
- name: Configure apache
become: true
group: root
mode: '0640'
force: no
- when: apache.rc != 0
+ when: not phd_conf.stat.exists
- name: Enable config
become: true
command: a2enconf 001-phd
notify: Reload apache
- when: apache.rc != 0
+ when: not phd_conf.stat.exists
- name: Configure logrotate
become: true