]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/apache/tasks/main.yml
0d81b0aeed4a9789a1bb47772799a4059a331acf
[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         cache_valid_time: 3600
18         install_recommends: no
19         name: apache2
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: Setup default host
39       become: true
40       copy:
41         src: _default_
42         dest: /usr/local/apache2
43         owner: root
44         group: www-data
45         directory_mode: '0755'
46         mode: '0644'
47
48     - name: Enable config
49       become: true
50       command: a2enconf 001-phd
51       notify: Reload apache
52   when: not phd_conf.stat.exists
53
54 - name: Configure logrotate
55   become: true
56   copy:
57     src: apache2
58     dest: /etc/logrotate.d
59     owner: root
60     group: root
61     mode: '0640'