Dies ist eine alte Version des Dokuments!
Proxmox container 'nextcloud.test'
Container setup
- IP: 10.2.0.20
- image: debian10 with users
Ansible setup
- verbindet man sich als unpriviligierter user und möchte ein Command als ein anderer, unpriviligierter user ausführen (z.B. www-data), benötigt man
allow_world_readable_tmpfiles = yes
in der ansible.cfg, damit dies nicht als Fehler zum Abbruch führt.
Ansible Script
#!/usr/bin/env ansible-playbook - name: 'install nextcloud' hosts: nextcloud become: true tasks: - name: remove apache2 apt: name: apache2 state: absent - name: install packages apt: pkg: - php7.3 - php7.3-curl - php7.3-gd - php7.3-json - php7.3-xml - php7.3-mbstring - php7.3-zip - php7.3-mysql - php7.3-bz2 - php7.3-intl - php7.3-redis - php7.3-imagick - php7.3-fpm - ffmpeg - nginx - name: Download nextcloud and unpack unarchive: src: https://download.nextcloud.com/server/releases/nextcloud-20.0.0.zip dest: /var/www owner: www-data group: www-data remote_src: yes - name: Remove file packed file file: path: /var/www/nextcloud-20.0.0.zip state: absent - name: first setup nextcloud become_user: www-data become: yes shell: | php occ maintenance:install --database mysql --database-host 10.3.0.100 --database-name nextcloud --database-table-prefix nc --database-user nc_user --database-pass "db-pass" --admin-user admin --admin-pass "admin-pass" --data-dir /var/www/nextcloud/data args: chdir: /var/www/nextcloud/ creates: /var/www/nextcloud/config/config.php - name: copy nginx config copy: src: ./conf/nextcloud.conf dest: /etc/nginx/sites-available/ owner: root group: root mode: '0744' - name: Create a symbolic link file: src: /etc/nginx/sites-available/nextcloud.conf dest: /etc/nginx/sites-enabled/nextcloud.conf owner: root group: root state: link - name: load php-fpm systemd: state: restarted name: php7.3-fpm - name: Restart nginx systemd: state: restarted daemon_reload: yes name: nginx