You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB

  1. ---
  2. - name: Install PhpMyAdmin
  3. collections: [ 'debops.debops', 'debops.roles01',
  4. 'debops.roles02', 'debops.roles03' ]
  5. hosts: [ 'debian10' ]
  6. vars_files:
  7. - ./../../vars/nginx.yml
  8. - ./../../vars/php.yml
  9. tasks:
  10. - name: Import DebOps secret role
  11. ansible.builtin.import_role:
  12. name: 'secret'
  13. - name: 'Adding pma nginx config'
  14. copy:
  15. dest: '/etc/nginx/sites-available/pma.conf'
  16. content: |-
  17. server {
  18. listen 80;
  19. listen 443;
  20. ssl_certificate /etc/pki/realms/domain/default.crt;
  21. ssl_certificate_key /etc/pki/realms/domain/default.key;
  22. server_name pma.{{ domain_name }};
  23. root /var/www/phpmyadmin;
  24. index index.php;
  25. include auth.d/pma-auth.conf;
  26. location / {
  27. try_files $uri $uri/ /index.php?$args;
  28. }
  29. set $upstream unix:/run/{{ php__version_preference[0] }}-fpm-www-data.sock;
  30. location ~ \.php$ {
  31. fastcgi_pass $upstream;
  32. include fastcgi_params;
  33. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  34. fastcgi_param SERVER_NAME $host;
  35. }
  36. }
  37. - name: 'Adding pma nginx auth config'
  38. copy:
  39. dest: '/etc/nginx/auth.d/pma-auth.conf'
  40. content: |-
  41. include auth.d/grant-access-certbot.conf;
  42. auth_basic_user_file passwords.d/pma.passwords;
  43. - name: 'Adding pma nginx auth passwords files'
  44. shell: |-
  45. echo "{{ site_name }}:$(openssl passwd -apr1 {{ lookup("password", secret + "/basic/" + site_name + "/pma " + "length=30")}} )" > /etc/nginx/passwords.d/pma.passwords
  46. - name: 'Turning on pma web site nginx config'
  47. shell: |-
  48. cd /etc/nginx/sites-enabled
  49. ln -s ../sites-available/pma.conf ./
  50. - name: 'Restarting nginx'
  51. shell: |-
  52. nginx -t && systemctl restart nginx