Browse Source

+ php-composer install own playbook with version downgrade for oldest php 7.4

* automatic detect php version and set php extension (for =>8 php version without installing gd, because Debian 11 need libgd3 fix for that)
* mapping tld hostname for non-www redirection moved to conf.d and copy that file to remote machine with others existing map-files
* some features in this commit not to be a tested in real environment
master
dimti 3 months ago
parent
commit
bbb84079df
  1. 4
      playbooks/debops/files/etc/nginx/conf.d/map_tld_domain.conf
  2. 5
      playbooks/debops/files/etc/nginx/includes.d/non-www.conf
  3. 6
      playbooks/debops/nginx.yml
  4. 2
      playbooks/nginx-site.yml
  5. 1
      playbooks/own/libgd3-fix-for-php8.yml
  6. 23
      playbooks/own/php-composer.yml

4
playbooks/debops/files/etc/nginx/conf.d/map_tld_domain.conf

@ -0,0 +1,4 @@
map $host $tld {
default $host;
'~^www\.(?<domain>.*)$' $domain;
}

5
playbooks/debops/files/etc/nginx/includes.d/non-www.conf

@ -6,11 +6,6 @@ if ( $http_host ~* "^www\.") {
if ( $nonwww ~* "^0+$" ) {
return 418;
}
# TODO: map need moved to conf.d
map $host $tld {
default $host;
'~^www\.(?<domain>.*)$' $domain;
}
location @nonwww {
rewrite ^ https://$tld$request_uri permanent;
}

6
playbooks/debops/nginx.yml

@ -77,6 +77,12 @@
dest: /etc/nginx/
mode: 0644
- name: Copy map config for www/non-www redirects
copy:
src: etc/nginx/conf.d/map_tld_domain.conf
dest: /etc/nginx/conf.d/
mode: 0644
post_tasks:
- name: Default index.html
template:

2
playbooks/nginx-site.yml

@ -5,6 +5,7 @@
- import_playbook: debops/mariadb_server.yml
- import_playbook: debops/mariadb-custom-db.yml
- import_playbook: debops/php-prod.yml
- import_playbook: own/libgd3-fix-for-php8.yml
- import_playbook: debops/nginx.yml
- import_playbook: debops/redis.yml
- import_playbook: own/var-www-set-ownerships.yml
@ -14,6 +15,7 @@
- import_playbook: own/nginx-auth.yml
- import_playbook: own/phpmyadmin.yml
- import_playbook: own/phpmyadmin-nginx-auth.yml
- import_playbook: own/php-composer.yml
#- import_playbook: own/correct-paths-for-pct-enter.yml
# Import all other group playbooks in this file...

1
playbooks/own/libgd3-fix-for-php8.yml

@ -1,6 +1,7 @@
---
- name: Solve problem with libgd3 for php-gd
hosts: [ 'debian10' ]
when: (php_version != '7.4')
vars_files:
- ./../../vars/php.yml
tasks:

23
playbooks/own/php-composer.yml

@ -0,0 +1,23 @@
---
- name: Install PHP Composer
collections: [ 'debops.debops', 'debops.roles01',
'debops.roles02', 'debops.roles03' ]
hosts: [ 'debian10' ]
tasks:
- name: Download and install composer
when: (php_version is defined)
shell: |-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
- name: Download and install composer
when: (php_version is defined and php_version == '7.4')
shell: |-
composer self-update 1.10.27
Loading…
Cancel
Save