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.

41 lines
1.6 KiB

  1. ---
  2. - name: Install PhpMyAdmin
  3. collections: [ 'debops.debops', 'debops.roles01',
  4. 'debops.roles02', 'debops.roles03' ]
  5. hosts: [ 'debian10' ]
  6. vars:
  7. - phpmyadmin_version: 5.2.1
  8. # https://docs.ansible.com/ansible/latest/collections/community/general/random_string_lookup.html#keyword-parameters
  9. - blowfish_secret: "{{ lookup('community.general.random_string', length=32) }}"
  10. tasks:
  11. - name: 'Download phpMyAdmin {{ phpmyadmin_version }} into var/www dir and uncompress'
  12. become: true
  13. become_user: '{{ site_name }}'
  14. shell: |-
  15. cd /var/www
  16. rm -rf phpmyadmin
  17. wget -q https://files.phpmyadmin.net/phpMyAdmin/{{ phpmyadmin_version }}/phpMyAdmin-{{ phpmyadmin_version }}-all-languages.zip
  18. unzip -qq phpMyAdmin-{{ phpmyadmin_version }}-all-languages.zip
  19. rm phpMyAdmin-{{ phpmyadmin_version }}-all-languages.zip
  20. mv phpMyAdmin-{{ phpmyadmin_version }}-all-languages phpmyadmin
  21. cd phpmyadmin
  22. cp config.sample.inc.php config.inc.php
  23. mkdir tmp && sudo chown :33 tmp && chmod g+w tmp
  24. - name: 'Set cookie blowfish secret'
  25. # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html
  26. replace:
  27. path: /var/www/phpmyadmin/config.inc.php
  28. regexp: "'blowfish_secret'] = ''"
  29. replace: "'blowfish_secret'] = '{{ blowfish_secret | replace('\'', '\\\'') }}'\n\n$cfg['CookieSameSite'] = 'Lax';\n"
  30. - name: 'Set MaxTableList'
  31. replace:
  32. path: /var/www/phpmyadmin/config.inc.php
  33. regexp: "^//$cfg['MaxRows'](.*)"
  34. replace: "//$cfg['MaxRows']\1\n\n$cfg['MaxTableList'] = 500;\n"