ReinerNippes / nextcloud_on_docker

Run Nextcloud in Docker Container on various Linux Hosts
MIT License
203 stars 48 forks source link

Ansible need to be executed on docker host and other small problems #100

Open schnuffle opened 3 years ago

schnuffle commented 3 years ago

I find it confusing that the whole setup needs to be executed on the docker host itself instead of launching it from a control host.

I identified two parts that would need minor change to be able to launch it from a control host:

Inventory

[nextcloud]

localhost ansible_connection=local ansible_user=root

docker.domain.tld ansible_python_interpreter=/usr/bin/python3 ansible_user=root

all.yml

The password lookup is done on the control host, so there need to be a secrets folder created

nextcloud_credential_store: "{{ nextcloud_base_dir }}/secrets"

nextcloud_credential_store: "secrets" # points to a local folder might add this to .gitignore

elasticsearch.yml

To build the image the Dockerfile has to be transfered and the folder needs to exists of course

fulltextsearch.yml

For nextcloud v21 the app fulltextsearch_tesseract does not exist anymore and needs to be removed

ReinerNippes commented 3 years ago

@schnuffle you are right there should be a note about inventory setup when you want to launch more then one nextcloud from a control host. the idea was to make it very easy for users to launch a nextcloud instance. nevertheless if the howto would start with: "first we setup a ansible control host ..." 50% of users new to nextcloud and ansible would be lost.

i you have to setup and maintain a lot of nextcloud server i would suggest to use an inventory in yaml and store the secret in the inventory. storing the passwords in a vault would allow you to commit your inventory to a git repository.

it would look like this: (not tested, full of typos)

---

all:
  hosts:
    vars:
      nextcloud_base_dir: /opt/nextcloud
      nextcloud_admin: 'admin'
      nextcloud_db_type: 'pgsql'
      .....

    nextcloud01:
      ansible_ssh_host: nexcloud01.mydomain.com
      nextcloud_server_fqdn: nexcloud01.mydomain.com
      nextcloud_passwd: !vault |
                   $ANSIBLE_VAULT;1.1;AES256
                   62313963663330643465383066373533616339663763623133343337346533663361353436303630
                   3136363038613230623334613531323236353637396565660a393933663631613766346566323330
                   38636133316139363837353532396430343532316636613233313738376633333535643762663637
                   6239363234636334630a353435626237323035333231396434326230386631646663326237643264
                   3765

  childern:
    fulltext_search:
      vars:
        fulltextsearch_enabled: false
      hosts:
        nextcloud01:

    collabora_en:
      vars:
        online_office: collabora
        collabora_dictionaries: 'en'
      hosts:
        nextcloud02:
    collabora_de:
      vars:
        online_office: collabora
        collabora_dictionaries: 'de'
      hosts:
        nextcloud03:

you would have to change the hosts: statement in the playbook to hosts: {{ server_name }} and start the playbook with server_name as an external variable.

i'll have a look at the elastic search containers problem.