nextcloud_on_docker
nextcloud_on_docker copied to clipboard
Ansible need to be executed on docker host and other small problems
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
-
name: Create folder for Dockerfiles file: path: /docker/elasticsearch_tesseract owner: root group: root state: directory
-
name: generate docker file template: src: elasticsearch_tesseract.j2 dest: /docker/elasticsearch_tesseract/Dockerfile
fulltextsearch.yml
For nextcloud v21 the app fulltextsearch_tesseract does not exist anymore and needs to be removed
-
name: install fulltextsearch apps shell: '{{ docker_occ_cmd }} app:install {{ item }}' args: creates: '{{ nextcloud_www_dir }}/apps/{{ item }}' loop:
- fulltextsearch
- fulltextsearch_elasticsearch
- files_fulltextsearch #- files_fulltextsearch_tesseract register: fulltextsearch_app_installed
-
name: enable fulltextsearch apps shell: '{{ docker_occ_cmd }} app:enable {{ item }}' loop:
- fulltextsearch
- fulltextsearch_elasticsearch
- files_fulltextsearch #- files_fulltextsearch_tesseract when: fulltextsearch_app_installed is changed
-
name: configure fulltextsearch app shell: '{{ docker_occ_cmd }} {{ item }}' loop:
- config:app:set fulltextsearch search_platform --value "OCA\FullTextSearch_Elasticsearch\Platform\ElasticSearchPlatform"
- config:app:set fulltextsearch app_navigation --value="1"
- config:app:set fulltextsearch_elasticsearch analyzer_tokenizer --value "standard"
- config:app:set fulltextsearch_elasticsearch elastic_host --value "http://elasticsearch_tesseract:9200"
- config:app:set fulltextsearch_elasticsearch elastic_index --value "nc_index"
- config:app:set files_fulltextsearch files_local --value="1"
- config:app:set files_fulltextsearch files_external --value="0"
- config:app:set files_fulltextsearch files_group_folders --value="1"
- config:app:set files_fulltextsearch files_encrypted --value="1"
- config:app:set files_fulltextsearch files_federated --value="0"
- config:app:set files_fulltextsearch files_size --value="20"
- config:app:set files_fulltextsearch files_pdf --value="1"
- config:app:set files_fulltextsearch files_office --value="1"
- config:app:set files_fulltextsearch files_image --value="1"
- config:app:set files_fulltextsearch files_audio --value="0" #- config:app:set files_fulltextsearch_tesseract tesseract_enabled --value="1" #- config:app:set files_fulltextsearch_tesseract tesseract_psm --value="4" #- config:app:set files_fulltextsearch_tesseract tesseract_lang --value="eng,de" #- config:app:set files_fulltextsearch_tesseract tesseract_pdf --value="1"
@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.