Dies ist eine alte Version des Dokuments!
Proxmox container 'nextcloud.test'
Status
- läuft, beta
Container setup
- image: debian10 with users
- 1. Netzwerkinterface
- eth0
- 10.2.0.20/24 DG: 10.2.0.254; fd00:10:2:0::20/64 DGfd00:10:2:0::0
- bridge: vmbr0
- 2. Netzwerkinterface:
- eth1,
- 10.3.0.20/24 DG: 10.3.0.254; fd00:10:3:0::20/64 DGfd00:10:3:0::0
- bridge: vmbr1
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: check if nextcloud is already installed stat: path: /var/www/nextcloud register: nextcloud_exists - 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 when: not nextcloud_exists.stat.exists - 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-port 3306 --database-user nc_user --database-pass 'dbpass' --admin-user admin --admin-pass 'ampass' --data-dir /var/www/nextcloud/data args: chdir: /var/www/nextcloud/ creates: /var/www/nextcloud/config/config.php - name: add domain to trusted domains become_user: www-data become: yes lineinfile: path: /var/www/nextcloud/config/config.php insertafter: .*localhost.* line: " 1 => 'bytecluster0002.bytespeicher.org'" firstmatch: yes - 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
Notizen
- Ansible script läd momentan das .zip nicht herunter. Fehler unbekannt.
- Sonderzeichen in Passwörtern führen zu fehlern. Genaue Escape-Sequence noch unbekannt.