]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/apache/tasks/main.yml
Feat: Use module `stat` instead of command `test`
[ansible.git] / playbooks / debian / roles / apache / tasks / main.yml
1 - name: Check apache
2   stat:
3     path: /etc/apache2/conf-enabled/001-phd.conf
4   register: phd_conf
5
6 - debug:
7     msg: "apache has already been configured"
8   when: not phd_conf.stats.exists
9
10 - name: Install apache
11   become: true
12   apt:
13     autoclean: yes
14     autoremove: yes
15     install_recommends: no
16     name: apache2
17     purge: yes
18     state: latest
19     update_cache: yes
20   when: not phd_conf.stats.exists
21
22 - name: Enable SSL module
23   become: true
24   command: a2enmod ssl
25   notify: Reload apache
26   when: not phd_conf.stats.exists
27
28 - name: Configure apache
29   become: true
30   template:
31     src: 001-phd.conf
32     dest: /etc/apache2/conf-available
33     owner: root
34     group: root
35     mode: '0640'
36     force: no
37   when: not phd_conf.stats.exists
38
39 - name: Enable config
40   become: true
41   command: a2enconf 001-phd
42   notify: Reload apache
43   when: not phd_conf.stats.exists
44
45 - name: Configure logrotate
46   become: true
47   copy:
48     src: apache2
49     dest: /etc/logrotate.d
50     owner: root
51     group: root
52     mode: '0640'