http_apache.yml 2.11 KB
Newer Older
Aalaesar's avatar
Aalaesar committed
1
---
2
- name: "[APACHE] -  enable APC for php CLI"
3
  lineinfile:
Aalaesar's avatar
Aalaesar committed
4
5
6
7
8
9
    dest: "{{ php_dir }}/cli/php.ini"
    line: "apc.enable_cli = 1"
    insertbefore: "^; End:$"
    state: present
    # validate: "/usr/sbin/{{ php_bin }} -t #%s"

Hispanico's avatar
Hispanico committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- name: "[APACHE] -  enable PHP OPcache for php.ini"
  lineinfile:
    dest: "{{ php_dir }}/apache2/php.ini"
    state: present
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
    backrefs: yes
  with_items:
    - { regexp: 'opcache.enable=0', line: 'opcache.enable=1' }
    - { regexp: 'opcache.enable_cli', line: 'opcache.enable_cli=1' }
    - { regexp: 'opcache.interned_strings_buffer', line: 'opcache.interned_strings_buffer=8' }
    - { regexp: 'opcache.max_accelerated_files', line: 'opcache.max_accelerated_files=10000' }
    - { regexp: 'opcache.memory_consumption', line: 'opcache.memory_consumption=128' }
    - { regexp: 'opcache.save_comments', line: 'opcache.save_comments=1' }
    - { regexp: 'opcache.revalidate_freq', line: 'opcache.revalidate_freq=1' }
    # validate: "/usr/sbin/{{ php_bin }} -t #%s"
Daniel Paufler's avatar
Daniel Paufler committed
26
  notify: reload http
Hispanico's avatar
Hispanico committed
27

28
29
30
31
32
33
34
35
- name: "[APACHE] -  Required Apache2 modules are enabled"
  apache2_module: state=present name={{ item }}
  with_items:
    - rewrite
    - headers
    - env
    - dir
    - mime
Daniel Paufler's avatar
Daniel Paufler committed
36
  notify: restart http
37

Hispanico's avatar
Hispanico committed
38
39
40
41
- name: "[APACHE] -  Ssl Apache2 module is enabled"
  apache2_module: state=present name={{ item }}
  with_items:
    - ssl
42
  when: (nextcloud_install_tls | bool)
Daniel Paufler's avatar
Daniel Paufler committed
43
  notify: restart http
Hispanico's avatar
Hispanico committed
44

45
- name: "[APACHE] -  generate Nextcloud configuration for apache"
Aalaesar's avatar
Aalaesar committed
46
  template:
47
    dest: /etc/apache2/sites-available/nc_{{ nextcloud_instance_name }}.conf
48
    src: "{{ nextcloud_websrv_template }}"
Daniel Paufler's avatar
Daniel Paufler committed
49
  notify: reload http
Aalaesar's avatar
Aalaesar committed
50

51
- name: "[APACHE] -  Enable Nextcloud site in apache conf"
Aalaesar's avatar
Aalaesar committed
52
  file:
53
54
    path: /etc/apache2/sites-enabled/nc_{{ nextcloud_instance_name }}.conf
    src: /etc/apache2/sites-available/nc_{{ nextcloud_instance_name }}.conf
Aalaesar's avatar
Aalaesar committed
55
    state: link
Daniel Paufler's avatar
Daniel Paufler committed
56
  notify: reload http
57
58
59
60
61

- name: "[APACHE] -  Disable apache default site"
  file:
    path: /etc/apache2/sites-enabled/000-default.conf
    state: absent
62
  when: nextcloud_disable_websrv_default_site | bool
63
  notify: reload http