✨: add nextcloud webapps
This commit is contained in:
15
roles/nextcloud/tasks/db.yml
Normal file
15
roles/nextcloud/tasks/db.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: Create nextcloud db role
|
||||
become_user: postgres
|
||||
become: true
|
||||
community.postgresql.postgresql_user:
|
||||
name: "{{ nextcloud_pg_role }}"
|
||||
password: "{{ nextcloud_pg_password }}"
|
||||
|
||||
- name: Create nextcloud db
|
||||
become_user: postgres
|
||||
become: true
|
||||
community.postgresql.postgresql_db:
|
||||
name: "{{ nextcloud_pg_database }}"
|
||||
owner: "{{ nextcloud_pg_role }}"
|
7
roles/nextcloud/tasks/main.yml
Normal file
7
roles/nextcloud/tasks/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Init db
|
||||
ansible.builtin.include_tasks: db.yml
|
||||
|
||||
- name: Install nextcloud
|
||||
ansible.builtin.include_tasks: nextcloud.yml
|
58
roles/nextcloud/tasks/nextcloud.yml
Normal file
58
roles/nextcloud/tasks/nextcloud.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
|
||||
- name: Create application directory
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ nextcloud_local_path }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Install nextcloud application
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ nextcloud_url }}"
|
||||
dest: "{{ nextcloud_local_path }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
exclude:
|
||||
- "data"
|
||||
- "config/config.php"
|
||||
|
||||
- name: Put config file
|
||||
ansible.builtin.template:
|
||||
src: "config.php.j2"
|
||||
dest: "{{ nextcloud_local_path }}/config/config.php"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "0o640"
|
||||
|
||||
- name: Set config dir permissions
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ nextcloud_local_path }}/config"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Check writable dirs
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ nextcloud_local_path }}/{{ item }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "g+w"
|
||||
recurse: true
|
||||
loop:
|
||||
- "apps"
|
||||
- "data"
|
||||
|
||||
- name: Run occ upgrade
|
||||
become: true
|
||||
become_user: www-data
|
||||
ansible.builtin.command:
|
||||
cmd: "php occ upgrade"
|
||||
chdir: "{{ nextcloud_local_path }}"
|
||||
changed_when: false
|
Reference in New Issue
Block a user