diff --git a/roles/server/nextcloud/defaults/main.yml b/roles/server/nextcloud/defaults/main.yml index dc082b8..19d9078 100644 --- a/roles/server/nextcloud/defaults/main.yml +++ b/roles/server/nextcloud/defaults/main.yml @@ -2,8 +2,7 @@ domain: "nextcloud.localhost" -nextcloud_system_user: "nextcloud" -system_user: "{{ nextcloud_system_user }}" +system_user: "nextcloud" nextcloud_gpg_fingerprint: "28806A878AE423A28372792ED75899B9A724937A" nextcloud_gpg_key_remote: "https://nextcloud.com/nextcloud.asc" @@ -20,7 +19,7 @@ nextcloud_release_file: "{{ nextcloud_user_directory }}/nextcloud.tar.bz2" nextcloud_release_signature: "{{ nextcloud_release_file }}.asc" nextcloud_config: "{{ nextcloud_installation_directory }}/config/config.php" -database_user: "{{ nextcloud_system_user }}" +database_user: "{{ system_user }}" # database_pass from mysql/database # database_name from mysql/database diff --git a/roles/server/nextcloud/tasks/install.yml b/roles/server/nextcloud/tasks/install.yml index 052b298..76095e9 100644 --- a/roles/server/nextcloud/tasks/install.yml +++ b/roles/server/nextcloud/tasks/install.yml @@ -1,7 +1,7 @@ --- - name: Download Nextcloud release - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" get_url: url: "{{ nextcloud_release_remote }}" checksum: "sha256:{{ nextcloud_release_remote_checksum }}" @@ -10,7 +10,7 @@ validate_certs: yes - name: Download signature for Nextcloud release - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" get_url: url: "{{ nextcloud_release_remote_signature }}" dest: "{{ nextcloud_release_signature }}" @@ -19,7 +19,7 @@ validate_certs: yes - name: Receive public key of Nextcloud developers - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" command: >- "{{ global_helper_directory }}/gpg_import_url_key.sh" {{ nextcloud_gpg_key_remote | quote }} @@ -29,7 +29,7 @@ chdir: "{{ nextcloud_user_directory }}" - name: Validate signature - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" command: >- /usr/bin/gpg2 --quiet @@ -40,13 +40,13 @@ chdir: "{{ nextcloud_user_directory }}" - name: Unpack Nextcloud release - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" unarchive: src: "{{ nextcloud_release_file }}" remote_src: yes dest: "{{ nextcloud_user_directory }}" - owner: "{{ nextcloud_system_user }}" - group: "{{ nextcloud_system_user }}" + owner: "{{ system_user }}" + group: "{{ system_user }}" - name: Remove installation files file: diff --git a/roles/server/nextcloud/tasks/main.yml b/roles/server/nextcloud/tasks/main.yml index 5015a55..4343eac 100644 --- a/roles/server/nextcloud/tasks/main.yml +++ b/roles/server/nextcloud/tasks/main.yml @@ -3,7 +3,7 @@ - name: Configure system user user: state: present - name: "{{ nextcloud_system_user }}" + name: "{{ system_user }}" system: yes shell: /bin/false create_home: yes @@ -137,7 +137,7 @@ check_mode: no - name: Download Nextcloud - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" include_tasks: install.yml when: not nextcloud_installed.stat.exists @@ -145,12 +145,12 @@ file: state: directory path: "{{ nextcloud_data_directory }}" - owner: "{{ nextcloud_system_user }}" - group: "{{ nextcloud_system_user }}" + owner: "{{ system_user }}" + group: "{{ system_user }}" mode: "u=rwx,g=rx" - name: Install Nextcloud - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" command: >- /usr/bin/php occ maintenance:install --database mysql @@ -166,7 +166,7 @@ creates: "{{ nextcloud_config }}" - name: Configure Nextcloud default domain - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" lineinfile: backrefs: yes path: "{{ nextcloud_config }}" @@ -176,7 +176,7 @@ validate: /usr/bin/php %s - name: Configure Nextcloud default domain for cli - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" lineinfile: backrefs: yes path: "{{ nextcloud_config }}" @@ -186,7 +186,7 @@ validate: /usr/bin/php %s - name: Install Nextcloud apps - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" command: "/usr/bin/php occ app:install {{ item | quote }}" args: chdir: "{{ nextcloud_installation_directory }}" @@ -254,7 +254,7 @@ - workflowengine - name: Set background job mode to cron - become_user: "{{ nextcloud_system_user }}" + become_user: "{{ system_user }}" command: /usr/bin/php occ background:cron args: chdir: "{{ nextcloud_installation_directory }}" @@ -263,7 +263,7 @@ cron: name: "nextcloud cron for {{ domain }}" minute: "*/5" - job: "sudo -u {{ nextcloud_system_user }} php -f \"{{ nextcloud_installation_directory }}/cron.php\"" + job: "sudo -u {{ system_user }} php -f \"{{ nextcloud_installation_directory }}/cron.php\"" - name: Configure auto backup of nextcloud data directory cron: @@ -274,7 +274,7 @@ state: present #- name: Upgrade Nextcloud -# become_user: "{{ nextcloud_system_user }}" +# become_user: "{{ system_user }}" # command: /usr/bin/php occ upgrade # args: # chdir: "{{ nextcloud_installation_directory }}" diff --git a/roles/server/nextcloud/templates/install_nextcloud.sh b/roles/server/nextcloud/templates/install_nextcloud.sh index 7744a03..a10f6e4 100755 --- a/roles/server/nextcloud/templates/install_nextcloud.sh +++ b/roles/server/nextcloud/templates/install_nextcloud.sh @@ -3,7 +3,7 @@ readonly CHECKSUM_TYPE="sha256"; readonly CHECKSUM_APP="${CHECKSUM_TYPE}sum"; readonly GPG_FINGERPRINT="{{ nextcloud_gpg_fingerprint }}"; -readonly NEXTCLOUD_USER="{{ nextcloud_system_user }}"; +readonly NEXTCLOUD_USER="{{ system_user }}"; readonly NEXTCLOUD_DIR="{{ nextcloud_installation_directory }}"; readonly NEXTCLOUD_GIT_REPO="{{ nextcloud_source_repo }}";