owncloud-ansible / owncloud

Ansible role for ownCloud 10
https://owncloud-ansible.github.io
Apache License 2.0
6 stars 7 forks source link

Owncloud install in play with multiple hosts fails (run_once=True) #27

Closed max-frank closed 4 years ago

max-frank commented 4 years ago

When trying to install owncloud on multiple nodes within one play only the first node is installed correctly. i.e., using a play such as this where owncloud is a group containing multiple hosts

- name: Install owncloud and required services
  hosts: owncloud
  become: true
  roles:
    - owncloud-mariadb
    - owncloud-redis
    - owncloud-apache
    - owncloud-php
    - owncloud

The reason for this seems to be the run_once set for the following task using the occ tool to finish installation:

- name: Automatically finish setup via the occ tool
  register: __owncloud_register_occ_install
  when: owncloud_do_autosetup | bool
  command: |
    {{ owncloud_occ_executable | quote }} maintenance:install
    "--data-dir={{ owncloud_data_path }}"
    "--database={{ owncloud_db_type }}"
    "--database-host={{ owncloud_db_host }}"
    {% if owncloud_db_type in ['mysql', 'pgsql'] %}
    "--database-name={{ owncloud_db_name }}"
    "--database-user={{ owncloud_db_user }}"
    "--database-pass={{ owncloud_db_password }}"
    "--database-table-prefix={{ owncloud_db_tableprefix }}"
    {% endif %}
    {% if owncloud_admin_username %}
    "--admin-user={{ owncloud_admin_username }}"
    "--admin-pass={{ owncloud_admin_password }}"
    {% endif %}
  run_once: True
  become: True
  become_user: "{{ owncloud_app_user }}"

From what I can see in the issues of this repo I believe you added this flag in case of cluster setups where this step only has to run on the main node (#9 ). Now sadly this decision completely breaks the usecase of installing unrelated instances using the same play as shown in the above example play.

My suggestion to support both is to replace the static True with a variable e.g., run_once: {{ owncloud_cluster_install }} This way the feature can be turned on/off.

enbrnz commented 4 years ago

Yes, I think this is a good idea!