summaryrefslogtreecommitdiff
path: root/roles/apps/bluespice/tasks/main.yml
blob: 899d1e1d784d0de70add370180ae7506d8bd4f69 (plain) (blame)
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
---
- name: create zfs datasets
  when: bluespice_zfs is defined
  block:
  - name: create zfs base dataset
    zfs:
      name: "{{ bluespice_zfs.pool }}/{{ bluespice_zfs.name }}"
      state: present
      extra_zfs_properties: "{{ bluespice_zfs.properties | dehumanize_zfs_properties | default(omit) }}"

  - name: create zfs volumes for instances
    loop: "{{ bluespice_instances | dict2items }}"
    loop_control:
      label: "{{ item.key }} ({{ (item.value.zfs_properties | default({})).items() | map('join', '=') | join(', ') }})"
    zfs:
      name: "{{ bluespice_zfs.pool }}/{{ bluespice_zfs.name }}/{{ item.key }}"
      state: present
      extra_zfs_properties: "{{ item.value.zfs_properties | dehumanize_zfs_properties | default(omit) }}"

  - name: configure bluespice base bath
    set_fact:
      bluespice_base_path: "{{ (zfs_pools[bluespice_zfs.pool].mountpoint, bluespice_zfs.name) | path_join }}"


- name: create instance subdirectories
  loop: "{{ bluespice_instances | list }}"
  file:
    path: "{{ bluespice_base_path }}/{{ item }}/data"
    state: directory


- name: install pod manifest
  loop: "{{ bluespice_instances | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  vars:
    kubernetes_standalone_pod:
      name: "bluespice-{{ item.key }}"
      spec: "{{ lookup('template', 'pod-spec.yml.j2') }}"
      mode: "0600"
  include_role:
    name: kubernetes/standalone/pod

- name: configure nginx vhost
  loop: "{{ bluespice_instances | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  vars:
    nginx_vhost:
      name: "bluespice-{{ item.key }}"
      template: generic
      acme: true
      hostnames:
      - "{{ item.value.hostname }}"
      locations:
        '/':
          proxy_pass: "http://127.0.0.1:{{ item.value.port }}"
          extra_directives: |-
            client_max_body_size 0;
  include_role:
    name: nginx/vhost