Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

CallePuzzle Dev profile imageCésar M. Cristóbal
César M. Cristóbal forCallePuzzle Dev

Posted on • Originally published atdev.callepuzzle.com

     

Desplegar Nextcloud en Docker usando Ansible

Nextcloud nos permite tener nuestro propioservidor de archivos a lo Dropbox. Pero a mí lo que más me gusta es poder tenermi calendario y mis contactos independiente del todopoderoso Google.

Vamos a ver como podemos desplegar Nextcloud en una Debian usando Docker y todo ello automatizado con Ansible.

El esquema que vamos a tener es una máquina Debian con tres contenedores dentro:

  • haproxy
  • nextcloud
  • mariadb

Nextcloud containerized

Requisitos

  • Tener acceso root a la máquina Debian.
  • Tener instalado Ansible.

A mí personalmente me gusta instalar Ansible en un virtualenv de python:

$virtualenv3 venv/py3$sourcevenv/py3/bin/activate(py3)$pipinstallansible
Enter fullscreen modeExit fullscreen mode

Instalamos los roles necesarios:

(py3)$ansible-galaxyinstalljilgue.ansible_role_docker_nextcloud(py3)$ansible-galaxyinstalljilgue.ansible_role_docker_haproxy
Enter fullscreen modeExit fullscreen mode

Playbook

A continuación vamos a generar la configuración de Ansible.

Necesitamos generar el inventario:

nextcloudansible_ssh_host=192.168.56.20
Enter fullscreen modeExit fullscreen mode

También la configuracion del haproxy:

global    daemon    maxconn 256defaults    mode http    timeout connect 5000ms    timeout client 50000ms    timeout server 50000msfrontend http-in    bind *:80    mode http    default_backend serversbackend servers    server server1 nextcloud:80 maxconn 32
Enter fullscreen modeExit fullscreen mode

Y por último el playbook:

----hosts:allbecome:truebecome_method:sudovars:nextcloud_trusted_domains:192.168.56.20nextcloud_ports:[]haproxy_cfg_template_path:"{{playbook_dir}}/"haproxy_links:-nextcloudhaproxy_ports:-80:80roles:-{role:nextcloud,tags:['nextcloud']}-{role:haproxy,tags:['haproxy']}
Enter fullscreen modeExit fullscreen mode

Y con esto tendríamos todo, al aplicar el playbook y entrar en la urlhttp://192.168.56.20/ podremos ver nuestro nextcloud instalado.

El usuario y contraseña por defecto sonadmin / admin.

Nextcloud welcome

Podéis ver la configuración de mi propio servidor engithub.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

More fromCallePuzzle Dev

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp