104 lines
2.3 KiB
YAML
104 lines
2.3 KiB
YAML
|
---
|
||
|
|
||
|
- name: Install apache2
|
||
|
ansible.builtin.apt:
|
||
|
pkg:
|
||
|
- apache2
|
||
|
|
||
|
- name: Create apache2 directory
|
||
|
ansible.builtin.file:
|
||
|
path: "{{ document_root }}/{{ package }}"
|
||
|
state: directory
|
||
|
mode: "0755"
|
||
|
owner: www-data
|
||
|
group: www-data
|
||
|
|
||
|
- name: Create PHP cli config directory
|
||
|
ansible.builtin.file:
|
||
|
path: "/etc/php/{{ php_version }}/cli"
|
||
|
state: directory
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: "0755"
|
||
|
|
||
|
- name: Copy in cli php.ini file
|
||
|
ansible.builtin.template:
|
||
|
src: files/php-cli-ini.j2
|
||
|
dest: "/etc/php/{{ php_version }}/cli/php.ini"
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Create PHP apache2 config directory
|
||
|
ansible.builtin.file:
|
||
|
path: "/etc/php/{{ php_version }}/apache2"
|
||
|
state: directory
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: "0755"
|
||
|
|
||
|
- name: Copy in apache2 php.ini file
|
||
|
ansible.builtin.template:
|
||
|
src: files/php-apache2-ini.j2
|
||
|
dest: "/etc/php/{{ php_version }}/apache2/php.ini"
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Remove default apache2 website
|
||
|
ansible.builtin.file:
|
||
|
dest: /etc/apache2/sites-enabled/000-default.conf
|
||
|
state: absent
|
||
|
|
||
|
- name: Configure NextCloud site
|
||
|
ansible.builtin.template:
|
||
|
src: files/nextcloud.conf.j2
|
||
|
dest: /etc/apache2/sites-available/nextcloud.conf
|
||
|
owner: root
|
||
|
group: root
|
||
|
mode: "0644"
|
||
|
|
||
|
- name: Enable apache2 module mod_rewrite
|
||
|
community.general.apache2_module:
|
||
|
name: rewrite
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module mod_headers
|
||
|
community.general.apache2_module:
|
||
|
name: headers
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module mod_env
|
||
|
community.general.apache2_module:
|
||
|
name: env
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module mod_dir
|
||
|
community.general.apache2_module:
|
||
|
name: dir
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module mod_mime
|
||
|
community.general.apache2_module:
|
||
|
name: mime
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module proxy_fcgi
|
||
|
community.general.apache2_module:
|
||
|
name: proxy_fcgi
|
||
|
state: present
|
||
|
|
||
|
- name: Enable apache2 module setenvif
|
||
|
community.general.apache2_module:
|
||
|
name: setenvif
|
||
|
state: present
|
||
|
|
||
|
- name: Configure apache2 - enable site
|
||
|
ansible.builtin.file:
|
||
|
src: /etc/apache2/sites-available/nextcloud.conf
|
||
|
dest: /etc/apache2/sites-enabled/nextcloud.conf
|
||
|
state: link
|
||
|
owner: root
|
||
|
group: root
|
||
|
notify: Restart apache2
|