ansible-nas/roles/cloudcmd/tasks/main.yml

43 lines
1.5 KiB
YAML
Raw Permalink Normal View History

2019-10-05 10:53:49 +00:00
---
2022-08-30 23:16:31 +00:00
- name: Start Cloudcmd
2022-08-28 16:00:31 +00:00
block:
- name: Create Cloudcmd Directories
2023-04-15 13:11:49 +00:00
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ cloudcmd_data_directory }}"
2019-10-05 10:53:49 +00:00
- name: Create Cloudcmd Docker Container
2023-04-15 13:11:49 +00:00
community.docker.docker_container:
name: "{{ cloudcmd_container_name }}"
image: coderaiser/cloudcmd
pull: true
volumes:
- "{{ cloudcmd_data_directory }}:/config:rw"
- "{{ cloudcmd_browse_directory }}:/mnt/fs"
ports:
- "{{ cloudcmd_port }}:8000"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ cloudcmd_user_id }}"
PGID: "{{ cloudcmd_group_id }}"
restart_policy: unless-stopped
memory: "{{ cloudcmd_memory }}"
labels:
traefik.enable: "{{ cloudcmd_available_externally | string }}"
traefik.http.routers.cloudcmd.rule: "Host(`{{ cloudcmd_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.cloudcmd.tls.certresolver: "letsencrypt"
traefik.http.routers.cloudcmd.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.cloudcmd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.cloudcmd.loadbalancer.server.port: "8000"
2022-08-28 16:00:31 +00:00
when: cloudcmd_enabled is true
- name: Stop Cloudcmd
block:
- name: Stop Cloudcmd
2023-04-15 13:11:49 +00:00
community.docker.docker_container:
name: "{{ cloudcmd_container_name }}"
state: absent
when: cloudcmd_enabled is false