--- - name: create zfs datasets when: wikijs_zfs is defined block: - name: create zfs base dataset zfs: name: "{{ wikijs_zfs.pool }}/{{ wikijs_zfs.name }}" state: present extra_zfs_properties: "{{ wikijs_zfs.properties | dehumanize_zfs_properties | default(omit) }}" - name: create zfs volumes for instances loop: "{{ wikijs_instances | dict2items }}" loop_control: label: "{{ item.key }} ({{ (item.value.zfs_properties | default({})).items() | map('join', '=') | join(', ') }})" zfs: name: "{{ wikijs_zfs.pool }}/{{ wikijs_zfs.name }}/{{ item.key }}" state: present extra_zfs_properties: "{{ item.value.zfs_properties | dehumanize_zfs_properties | default(omit) }}" - name: configure wikijs base bath set_fact: wikijs_base_path: "{{ (zfs_pools[wikijs_zfs.pool].mountpoint, wikijs_zfs.name) | path_join }}" - name: create instance subdirectories when: wikijs_zfs is not defined loop: "{{ wikijs_instances | list }}" file: path: "{{ wikijs_base_path }}/{{ item }}" state: directory - name: add group for wikijs db group: name: wikijs-db gid: "{{ wikijs_db_gid }}" - name: add user for wikijs db user: name: wikijs-db uid: "{{ wikijs_db_uid }}" group: wikijs-db password: "!" - name: create wikijs database subdirectory loop: "{{ wikijs_instances | dict2items}}" loop_control: label: "{{ item.key }}" file: path: "{{ wikijs_base_path }}/{{ item.key }}/postgres" owner: "{{ wikijs_db_uid }}" group: "{{ wikijs_db_gid }}" state: directory - name: install pod manifest loop: "{{ wikijs_instances | dict2items }}" loop_control: label: "{{ item.key }}" vars: kubernetes_standalone_pod: name: "wikijs-{{ item.key }}" spec: "{{ lookup('template', 'pod-spec.yml.j2') }}" mode: "0600" include_role: name: kubernetes/standalone/pod - name: configure nginx vhost loop: "{{ wikijs_instances | dict2items }}" loop_control: label: "{{ item.key }}" vars: nginx_vhost: name: "wikijs-{{ item.key }}" template: generic tls: certificate_provider: "{{ acme_client }}" 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