aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/nextcloud/tasks
diff options
context:
space:
mode:
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'