77 lines
2.5 KiB
YAML
77 lines
2.5 KiB
YAML
---
|
|
- name: Create opencloud directory
|
|
ansible.builtin.file:
|
|
path: "{{ node['home_path'] }}/{{ item }}"
|
|
state: "directory"
|
|
owner: "{{ services['opencloud']['subuid'] }}"
|
|
group: "svadmins"
|
|
mode: "0770"
|
|
loop:
|
|
- "data/containers/opencloud"
|
|
- "containers/opencloud"
|
|
become: true
|
|
|
|
- name: Check data directory empty
|
|
ansible.builtin.stat:
|
|
path: "{{ node['home_path'] }}/data/containers/opencloud/.init"
|
|
become: true
|
|
register: "is_opencloud_init"
|
|
|
|
- name: Initialize opencloud
|
|
when: not is_opencloud_init.stat.exists
|
|
block:
|
|
- name: Execute init command (Including pulling image)
|
|
containers.podman.podman_container:
|
|
name: "opencloud_init"
|
|
image: "docker.io/opencloudeu/opencloud:{{ version['containers']['opencloud'] }}"
|
|
command: "init"
|
|
state: "started"
|
|
rm: true
|
|
detach: false
|
|
env:
|
|
IDM_ADMIN_PASSWORD: "{{ hostvars['console']['opencloud']['admin']['password'] }}"
|
|
# Verify the certificate (Opencloud to Authelia, authelia uses let's encrypt.)
|
|
OC_INSECURE: "true"
|
|
volume:
|
|
- "{{ node['home_path'] }}/containers/opencloud:/etc/opencloud:rw"
|
|
- "{{ node['home_path'] }}/data/containers/opencloud:/var/lib/opencloud:rw"
|
|
no_log: true
|
|
|
|
- name: Create .init file
|
|
ansible.builtin.file:
|
|
path: "{{ node['home_path'] }}/data/containers/opencloud/.init"
|
|
state: "touch"
|
|
mode: "0644"
|
|
owner: "{{ ansible_user }}"
|
|
group: "svadmins"
|
|
|
|
- name: Deploy configuration files
|
|
ansible.builtin.template:
|
|
src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/app/opencloud/etc/{{ item }}.j2"
|
|
dest: "{{ node['home_path'] }}/containers/opencloud/{{ item }}"
|
|
owner: "{{ services['opencloud']['subuid'] }}"
|
|
group: "svadmins"
|
|
mode: "0640"
|
|
loop:
|
|
- "csp.yaml"
|
|
- "proxy.yaml"
|
|
become: true
|
|
notify: "notification_restart_opencloud"
|
|
|
|
- name: Deploy container file
|
|
ansible.builtin.template:
|
|
src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/app/opencloud/opencloud.container.j2"
|
|
dest: "{{ node['home_path'] }}/.config/containers/systemd/opencloud.container"
|
|
owner: "{{ ansible_user }}"
|
|
group: "svadmins"
|
|
mode: "0644"
|
|
notify: "notification_restart_opencloud"
|
|
|
|
- name: Enable opencloud.service
|
|
ansible.builtin.systemd:
|
|
name: "opencloud.service"
|
|
state: "started"
|
|
enabled: true
|
|
daemon_reload: true
|
|
scope: "user"
|