-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextcloud-storage-playbook.yml
73 lines (73 loc) · 2.03 KB
/
nextcloud-storage-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
# requires linux-system-roles package!!
# ansible-playbook -i ansible-inventory.yml --ask-become-pass k3s-local-storage-playbook.yml
#
- name: Prepare storage
hosts: localhost
become: yes
vars:
storage_volume_path: /mnt/cloudmainlv
grps:
nextcloud: 524320
postgres: 525286
usrs:
nextcloud:
uid: 524320
home: "{{ storage_volume_path }}/nextcloud_app"
postgres:
uid: 525286
home: "{{ storage_volume_path }}/nextcloud_database"
tasks:
- name: Prepare storage groups
group:
name: "{{ item.key }}"
gid: "{{ item.value }}"
loop: "{{ grps | dict2items }}"
- name: Prepare storage users
user:
name: "{{ item.key }}"
uid: "{{ item.value.uid }}"
umask: 007
shell: /sbin/nologin
create_home: no
loop: "{{ usrs | dict2items }}"
- name: Prepare disks
ansible.builtin.include_role:
name: linux-system-roles.storage
vars:
#storage_safe_mode: false
storage_pools:
- name: appvg
state: present
type: lvm
disks:
- vdb
volumes:
- name: appmainlv
fs_type: xfs
size: 100%
mount_point: "{{ storage_volume_path }}"
mount_user: nextcloud
mount_group: nextcloud
- name: app directory
file:
path: "{{ item }}"
state: directory
loop:
- "{{ usrs.nextcloud.home }}"
- "{{ usrs.nextcloud.home }}/config"
- "{{ usrs.nextcloud.home }}/tmp"
- "{{ usrs.postgres.home }}"
- "{{ storage_volume_path }}/jellyfin/config"
- name: Set HOME dir for storage users
user:
name: "{{ item.key }}"
home: "{{ item.value.home }}"
loop: "{{ usrs | dict2items }}"
- name: Make sure the current user is in the storage group
user:
name: "{{ ansible_user }}"
append: yes
groups:
- nextcloud
- postgres