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.

58 lines
1.8 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/php.yml
  8. tasks:
  9. - name: Import DebOps secret role
  10. ansible.builtin.import_role:
  11. name: 'secret'
  12. - name: 'Adding pma nginx config'
  13. copy:
  14. dest: '/etc/nginx/sites-available/pma.conf'
  15. content: |-
  16. server {
  17. listen 81;
  18. server_name {{ site_name }};
  19. root /var/www/phpmyadmin;
  20. index index.php;
  21. include auth.d/pma-auth.conf;
  22. location / {
  23. try_files $uri $uri/ /index.php?$args;
  24. }
  25. set $upstream unix:/run/{{ php__version_preference[0] }}-fpm-www-data.sock;
  26. location ~ \.php$ {
  27. fastcgi_pass $upstream;
  28. include fastcgi_params;
  29. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  30. fastcgi_param SERVER_NAME $host;
  31. }
  32. }
  33. - name: 'Adding pma nginx auth config'
  34. copy:
  35. dest: '/etc/nginx/auth.d/pma-auth.conf'
  36. content: |-
  37. include auth.d/grant-access-certbot.conf;
  38. auth_basic_user_file passwords.d/pma.passwords;
  39. - name: 'Adding pma nginx auth passwords files'
  40. shell: |-
  41. echo "{{ site_name }}:$(openssl passwd -apr1 {{ lookup("password", secret + "/basic/" + site_name + "/pma " + "length=30")}} )" > /etc/nginx/passwords.d/pma.passwords
  42. - name: 'Turning on pma web site nginx config'
  43. shell: |-
  44. cd /etc/nginx/sites-enabled
  45. ln -s ../sites-available/pma.conf ./
  46. - name: 'Restarting nginx'
  47. shell: |-
  48. nginx -t && systemctl restart nginx