Playbook für die Nextcloud Notfalleinrichtung.

This commit is contained in:
2025-08-18 10:08:39 +02:00
parent 99a9fbc8ae
commit 3a876c13a9
24 changed files with 516 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
- name: Abbrechen, wenn /mnt/nextcloud nicht gemountet ist
fail:
msg: "/mnt/nextcloud ist nicht gemountet Playbook wird abgebrochen."
when: "'/mnt/nextcloud' not in (ansible_mounts | map(attribute='mount') | list)"
- name: create home dirs
file:
path: "~/{{ item }}"
state: directory
loop: "{{ homedirs }}"
- name: create volume dir
become: true
file:
path: "{{ item }}"
state: directory
owner: pi
group: pi
mode: '0755'
loop: "{{ volumedirs }}"
- name: create nextcloud dirs
file:
path: ~/{{ item}}
state: directory
loop: "{{ ncdirs }}"

View File

@@ -0,0 +1,24 @@
- name: Clone docker-compose repository
ansible.builtin.git:
repo: "{{ dockerrepo }}"
dest: "{{ dockerdir }}"
version: master
- name: Permission für Docker
become: true
file: path=/var/run/docker.sock mode=0660
# mode: 660
- name: adding user pi to docker group
become: true
user:
name: pi
groups: docker,video
- name: Run docker-compose up
community.docker.docker_compose:
project_src: '{{dockerdir }}/compose/nextcloud'
state: present
become: true

View File

@@ -0,0 +1,13 @@
- name: PI Update
become: true
apt:
update_cache: yes
upgrade: dist
- name: Pakete installieren
become: true
ansible.builtin.apt:
name: "{{ packages }}"
state: present
update_cache: yes
cache_valid_time: 86400

View File

@@ -0,0 +1,12 @@
- include_vars: "roles/initnextcloud/vars/dirs.yml"
- include_vars: "roles/initnextcloud/vars/partuuid.yml"
- include_vars: "roles/initnextcloud/vars/pckg.yml"
- include_tasks: ../subtasks/upgrade.yml
- import_tasks: install.yml
- import_tasks: mount.yml
- import_tasks: dirs.yml
- import_tasks: docker.yml
- import_tasks: optional.yml

View File

@@ -0,0 +1,16 @@
- name: Add Nextcloud mount to fstab
become: true
ansible.builtin.blockinfile:
path: /etc/fstab
marker: "# {mark} ANSIBLE MANAGED BLOCK nextcloud"
block: |
PARTUUID={{ partuuid }} /mnt/nextcloud ext4 defaults,fail 0 1
- name: Mount /mnt/nextcloud
become: true
ansible.posix.mount:
path: /mnt/nextcloud
state: mounted
fstype: ext4
src: PARTUUID={{ partuuid }}

View File

@@ -0,0 +1,13 @@
- name: copy scripts
copy:
src: "{{ item }}"
dest: /home/pi/bin
mode: '0755'
loop: "{{ query('fileglob', 'files/scripts/*') }}"
- name: copy resources to ~
copy:
src: "{{ item }}"
dest: /home/pi
loop: "{{ query('fileglob', 'resources/*') }}"