aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/med_dl/tasks/setup.yaml
blob: b1a18738ff7c574532a30b0b75c3146a05b7fcdf (plain)
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
---

- name: 'setup | Ensure required vars are set'
  ansible.builtin.assert:
    that:
      - item | mandatory
  loop:
    - '{{ med_dl_nas_mount_path }}'
  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: '777'

- name: 'setup | Setup the NFS mount'
  ansible.posix.mount:
    src: '{{ med_dl_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'