]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/apache/tasks/main.yml
Feat(apt): Remove option `purge`
[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         state: latest
20         update_cache: yes
21
22     - name: Enable SSL module
23       become: true
24       command: a2enmod ssl
25       notify: Reload apache
26
27     - name: Configure apache
28       become: true
29       template:
30         src: 001-phd.conf
31         dest: /etc/apache2/conf-available
32         owner: root
33         group: root
34         mode: '0640'
35         force: no
36
37     - name: Setup default host
38       become: true
39       copy:
40         src: _default_
41         dest: /usr/local/apache2
42         owner: root
43         group: www-data
44         directory_mode: '0755'
45         mode: '0644'
46
47     - name: Enable config
48       become: true
49       command: a2enconf 001-phd
50       notify: Reload apache
51   when: not phd_conf.stat.exists
52
53 - name: Configure logrotate
54   become: true
55   copy:
56     src: apache2
57     dest: /etc/logrotate.d
58     owner: root
59     group: root
60     mode: '0640'