Cloudcmd starts and stops

This commit is contained in:
David Stephens 2022-08-28 17:00:31 +01:00
parent 3c8e1968ff
commit 6a0b4c57b5
4 changed files with 44 additions and 30 deletions

View file

@ -64,7 +64,6 @@
- role: cloudcmd - role: cloudcmd
tags: tags:
- cloudcmd - cloudcmd
when: (cloudcmd_enabled | default(False))
- role: cloudflare_ddns - role: cloudflare_ddns
tags: tags:

View file

@ -17,3 +17,6 @@ cloudcmd_port: "7373"
# specs # specs
cloudcmd_memory: "1g" cloudcmd_memory: "1g"
# docker
cloudcmd_container_name: cloudcmd

View file

@ -0,0 +1,9 @@
---
- name: Stop Cloudcmd
docker_container:
name: "{{ cloudcmd_container_name }}"
state: absent
when: cloudcmd_enabled is false
listen:
- "stop cloudcmd"
- "stop disabled applications"

View file

@ -1,31 +1,34 @@
--- ---
- name: Create Cloudcmd Directories - name: Cloudcmd
file: block:
path: "{{ item }}" - name: Create Cloudcmd Directories
state: directory file:
with_items: path: "{{ item }}"
- "{{ cloudcmd_data_directory }}" state: directory
with_items:
- "{{ cloudcmd_data_directory }}"
- name: Create Cloudcmd Docker Container - name: Create Cloudcmd Docker Container
docker_container: docker_container:
name: cloudcmd name: "{{ cloudcmd_container_name }}"
image: coderaiser/cloudcmd image: coderaiser/cloudcmd
pull: true pull: true
volumes: volumes:
- "{{ cloudcmd_data_directory }}:/config:rw" - "{{ cloudcmd_data_directory }}:/config:rw"
- "{{ cloudcmd_browse_directory }}:/mnt/fs" - "{{ cloudcmd_browse_directory }}:/mnt/fs"
ports: ports:
- "{{ cloudcmd_port }}:8000" - "{{ cloudcmd_port }}:8000"
env: env:
TZ: "{{ ansible_nas_timezone }}" TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ cloudcmd_user_id }}" PUID: "{{ cloudcmd_user_id }}"
PGID: "{{ cloudcmd_group_id }}" PGID: "{{ cloudcmd_group_id }}"
restart_policy: unless-stopped restart_policy: unless-stopped
memory: "{{ cloudcmd_memory }}" memory: "{{ cloudcmd_memory }}"
labels: labels:
traefik.enable: "{{ cloudcmd_available_externally | string }}" traefik.enable: "{{ cloudcmd_available_externally | string }}"
traefik.http.routers.cloudcmd.rule: "Host(`{{ cloudcmd_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.cloudcmd.rule: "Host(`{{ cloudcmd_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.cloudcmd.tls.certresolver: "letsencrypt" 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].main: "{{ ansible_nas_domain }}"
traefik.http.routers.cloudcmd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" traefik.http.routers.cloudcmd.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.cloudcmd.loadbalancer.server.port: "8000" traefik.http.services.cloudcmd.loadbalancer.server.port: "8000"
when: cloudcmd_enabled is true