====== Proxmox container 'wordpress.test' (entfernt) ======
===== Status =====
* up and running as http://bytecluster0002.bytespeicher.org:8086
* has problems with loopback device cause the server can't reach itself with the external URL
===== Container setup =====
* image: debian10 with users
* 1. Netzwerkinterface
* eth0
* 10.2.0.30/24 DG: 10.2.0.254; fd00:10:2:0::30/64 DGfd00:10:2:0::0
* bridge: vmbr0
* 2. Netzwerkinterface:
* eth1,
* 10.3.0.30/24; fd00:10:3:0::30/64
* 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: wordpress
become: true
tasks:
- name: remove apache2
apt:
name: apache2
state: absent
- name: install packages
apt:
pkg:
- php7.3
- php7.3-xml
- php7.3-mbstring
- php7.3-zip
- php7.3-mysql
- php7.3-imagick
- php7.3-curl
- php7.3-fpm
- nginx
- name: Remove default nginx demo site
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: check if nextcloud is already installed
stat:
path: /var/www/wordpress
register: wordpress_exists
- name: Download wordpress and unpack
unarchive:
src: https://wordpress.org/latest.zip
dest: /var/www
owner: www-data
group: www-data
remote_src: yes
when: not wordpress_exists.stat.exists
- name: Remove file packed file
file:
path: /var/www/latest.zip
state: absent
- name: copy wordpress config
copy:
src: ./conf/wp-config.php
dest: /var/www/wordpress/
owner: www-data
group: www-data
mode: '0644'
- name: Download wp-cli wordpress command line interface
get_url:
url: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
dest: /usr/local/bin/wp
mode: '0777'
- name: finish installation
become_user: www-data
become: yes
shell: |
wp core install --url='http://bytecluster0002.bytespeicher.org:8086' --title='Technikkultur Erfurt e.V. / Bytespeicher / Makerspace Erfurt' --admin_user=admin --admin_password=****** --admin_email='admin@technikkultur-erfurt.de'
args:
chdir: /var/www/wordpress/
- name: copy nginx config
copy:
src: ./conf/wordpress.conf
dest: /etc/nginx/sites-available/
owner: root
group: root
mode: '0744'
- name: Create a symbolic link
file:
src: /etc/nginx/sites-available/wordpress.conf
dest: /etc/nginx/sites-enabled/wordpress.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 ====
===== wp-config.php =====
* liegt unter ///var/www/wordpress//
===== NGINX Config =====
server {
listen 8086;
listen [::]:8086;
root /var/www/wordpress;
index index.php index.html index.htm;
server_name bytecluster0002.bytespeicher.org;
error_log /var/log/nginx/wordpress.log;
access_log /var/log/nginx/wordpress.log;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}