2020-10-02 16:51:05 +02:00
|
|
|
---
|
2023-11-09 16:48:17 +01:00
|
|
|
- name: Check nextcloud user id is over 2999
|
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
|
|
|
- nextcloud_user_uid >= 3000
|
|
|
|
|
2022-09-01 12:38:10 +02:00
|
|
|
- name: Create {{ nextcloud_user }} unix group
|
2023-03-20 23:33:19 +01:00
|
|
|
|
|
|
|
ansible.builtin.group:
|
2022-09-01 12:02:23 +02:00
|
|
|
name: "{{ nextcloud_user | mandatory }}"
|
2020-10-02 16:51:05 +02:00
|
|
|
state: present
|
2023-11-09 16:48:17 +01:00
|
|
|
gid: "{{ nextcloud_user_uid | mandatory }}"
|
2020-10-02 16:51:05 +02:00
|
|
|
tags:
|
|
|
|
- nextcloud
|
|
|
|
|
2022-09-01 12:38:10 +02:00
|
|
|
- name: Create {{ nextcloud_user | mandatory }} unix user
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.user:
|
2020-10-02 16:51:05 +02:00
|
|
|
name: "{{ nextcloud_user | mandatory }}"
|
2022-09-01 12:02:23 +02:00
|
|
|
group: "{{ nextcloud_user | mandatory }}"
|
2020-10-02 16:51:05 +02:00
|
|
|
home: "{{ nextcloud_home | mandatory }}"
|
2023-11-09 15:19:15 +01:00
|
|
|
uid: "{{ nextcloud_user_uid | mandatory }}"
|
2020-10-02 16:51:05 +02:00
|
|
|
shell: '/bin/bash'
|
2021-10-26 15:34:13 +02:00
|
|
|
create_home: True
|
2020-10-02 16:51:05 +02:00
|
|
|
state: present
|
2021-10-26 15:34:13 +02:00
|
|
|
# mode: "0755"
|
2020-10-02 16:51:05 +02:00
|
|
|
tags:
|
|
|
|
- nextcloud
|
|
|
|
|
|
|
|
- name: Create top-level directories
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2020-10-02 16:51:05 +02:00
|
|
|
dest: "{{ item }}"
|
|
|
|
state: directory
|
2022-09-01 12:38:10 +02:00
|
|
|
mode: "0700"
|
2020-10-02 16:51:05 +02:00
|
|
|
owner: "{{ nextcloud_user }}"
|
|
|
|
group: "{{ nextcloud_user }}"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2020-10-02 16:51:05 +02:00
|
|
|
- "{{ nextcloud_home }}/log"
|
|
|
|
- "{{ nextcloud_home }}/tmp"
|
|
|
|
- "{{ nextcloud_home }}/data"
|
|
|
|
tags:
|
|
|
|
- nextcloud
|
2023-05-19 16:21:41 +02:00
|
|
|
|
|
|
|
- name: Mount up Ceph volume by UUID
|
|
|
|
ansible.posix.mount:
|
|
|
|
path: "{{ nextcloud_data }}"
|
2023-12-07 11:02:04 +01:00
|
|
|
src: "UUID={{ nextcloud_data_uuid }}"
|
2023-05-19 16:21:41 +02:00
|
|
|
fstype: ext4
|
|
|
|
opts: defaults,noexec,nosuid,nodev,relatime,lazytime
|
2023-12-07 09:34:04 +01:00
|
|
|
state: mounted
|
2023-12-07 09:42:34 +01:00
|
|
|
|
|
|
|
- name: Set volume's root permissions and ownership
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ nextcloud_data }}"
|
|
|
|
owner: "{{ nextcloud_user }}"
|
|
|
|
group: "{{ nextcloud_user }}"
|
|
|
|
mode: "0700"
|