]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/apache/tasks/main.yml
c05eb6f280fe6eb8d4cd2fb017349addea498664
[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   changed_when: not phd_conf.stat.exists
6
7 - debug:
8     msg: "apache has already been configured"
9   when: phd_conf.stat.exists
10
11 - block:
12     - name: Install apache
13       become: true
14       apt:
15         autoclean: yes
16         autoremove: yes
17         install_recommends: no
18         name: apache2
19         purge: yes
20         state: latest
21         update_cache: yes
22
23     - name: Enable SSL module
24       become: true
25       command: a2enmod ssl
26       notify: Reload apache
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
38     - name: Enable config
39       become: true
40       command: a2enconf 001-phd
41       notify: Reload apache
42   when: not phd_conf.stat.exists
43
44 - name: Configure logrotate
45   become: true
46   copy:
47     src: apache2
48     dest: /etc/logrotate.d
49     owner: root
50     group: root
51     mode: '0640'