This guide deploys OpenCloud with Docker Compose on Debian 10 to latest stable, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy OpenCloud
hosts: opencloud
become: true
vars:
app_root: /opt/opencloud
app_port: 8080
admin_username: admin
admin_password: "{{ vault_opencloud_admin_password }}"
oc_url: "https://cloud.example.com"
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-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create app 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.8'
services:
opencloud:
image: opencloudeu/opencloud:latest
container_name: opencloud
restart: unless-stopped
ports:
- "{{ app_port }}:8080"
volumes:
- ./data:/root/.opencloud
environment:
- OC_URL={{ oc_url }}
- OC_ADMIN_USERNAME={{ admin_username }}
- OC_ADMIN_PASSWORD={{ admin_password }}
cap_add:
- SYS_CHROOT
- SYS_ADMIN
- name: Start application stack
community.docker.docker_compose:
project_src: "{{ app_root }}"
state: present
- name: Wait for OpenCloud to be ready
uri:
url: "http://localhost:{{ app_port }}"
status_code: 200
register: result
until: result.status == 200
retries: 30
delay: 5
Create an ansible-vault file with secure passwords:
# group_vars/all/vault.yml
vault_opencloud_admin_password: "your-secure-admin-password-here"
# Run the playbook
ansible-playbook -i inventory.ini opencloud.yml
# With vault password
ansible-playbook -i inventory.ini opencloud.yml --ask-vault-pass
For production deployments, consider adding:
./data directory (filesystem storage)See Configuration and Security for production hardening.
Any questions?
Feel free to contact us. Find all contact information on our contact page.