aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/nextcloud/tasks
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2023-08-11 16:28:54 +0000
committerKumar Damani <me@kumardamani.net>2023-08-11 16:28:54 +0000
commita8a40383081441ebd3757a501364b9ac45eb421e (patch)
treef48b7040615af1bda263faa4d2657636c77ba2a4 /ansible/roles/nextcloud/tasks
parent9bae899e227e4899a5ee629bf305a00a39044bc2 (diff)
parent1f321db8949b3aeb80afdd7a94e92b7743c3e275 (diff)
Merge branch 'work' into 'main'
Work See merge request kdam0/home-lab!1
Diffstat (limited to 'ansible/roles/nextcloud/tasks')
-rw-r--r--ansible/roles/nextcloud/tasks/main.yaml5
-rw-r--r--ansible/roles/nextcloud/tasks/setup.yaml40
2 files changed, 45 insertions, 0 deletions
diff --git a/ansible/roles/nextcloud/tasks/main.yaml b/ansible/roles/nextcloud/tasks/main.yaml
new file mode 100644
index 0000000..0d3697b
--- /dev/null
+++ b/ansible/roles/nextcloud/tasks/main.yaml
@@ -0,0 +1,5 @@
+---
+
+- name: 'Run the setup tasks'
+ ansible.builtin.import_tasks: 'setup.yaml'
+ tags: 'nextcloud'
diff --git a/ansible/roles/nextcloud/tasks/setup.yaml b/ansible/roles/nextcloud/tasks/setup.yaml
new file mode 100644
index 0000000..ac17702
--- /dev/null
+++ b/ansible/roles/nextcloud/tasks/setup.yaml
@@ -0,0 +1,40 @@
+---
+
+- name: 'setup | Ensure required vars are set'
+ ansible.builtin.assert:
+ that:
+ - item | mandatory
+ loop:
+ - '{{ nextcloud_nas_mount_path }}'
+ - '{{ nextcloud_php_max_mem_mb }}'
+ - '{{ nextcloud_php_max_upload_size_gb }}'
+ no_log: true
+
+- name: 'setup | Install required pkgs'
+ ansible.builtin.package:
+ name:
+ - 'nfs-common'
+
+- name: 'setup | Create the mount dir'
+ ansible.builtin.file:
+ path: '/mnt/data'
+ state: 'directory'
+ mode: '755'
+
+- name: 'setup | Setup the NFS mount'
+ ansible.posix.mount:
+ src: '{{ nextcloud_nas_mount_path }}'
+ path: '/mnt/data'
+ state: 'mounted'
+ fstype: 'nfs'
+
+- name: 'setup | Copy the docker-compose file'
+ ansible.builtin.template:
+ src: 'docker-compose.yaml.j2'
+ dest: 'docker-compose.yaml'
+ mode: '644'
+
+- name: 'setup | Start the service'
+ ansible.builtin.command: 'docker-compose up -d'
+ register: '_compose_up_cmd'
+ changed_when: '_compose_up_cmd.rc == 0'