This guide provides a full Ansible playbook to deploy Cozy Cloud with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Cozy Cloud
hosts: cozy-cloud
become: true
vars:
app_root: /opt/cozy-cloud
app_port: 8080
cozy_domain: cozy.example.com
cozy_secret: generate-a-secure-secret-key
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create application directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
version: '3'
services:
cozy-stack:
image: cozy/cozy-stack:latest
container_name: cozy-stack
restart: unless-stopped
ports:
- "{{ app_port }}:8080"
environment:
- COZY_DOMAIN={{ cozy_domain }}
- COZY_SECRET={{ cozy_secret }}
- COZY_COUCHDB=couchdb:5984
volumes:
- cozy_data:/var/lib/cozy
depends_on:
- couchdb
couchdb:
image: couchdb:3
container_name: cozy-couchdb
restart: unless-stopped
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=secure-password
volumes:
- couchdb_data:/opt/couchdb/data
volumes:
cozy_data:
couchdb_data:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
cozy/cozy-stack on Docker Hub (not GHCR)Any questions?
Feel free to contact us. Find all contact information on our contact page.