GithubHelp home page GithubHelp logo

geerlingguy / ansible-role-phpmyadmin Goto Github PK

View Code? Open in Web Editor NEW
43.0 5.0 41.0 47 KB

DEPRECATED Ansible Role - phpMyAdmin

Home Page: https://galaxy.ansible.com/geerlingguy/phpmyadmin/

License: MIT License

ansible role phpmyadmin php mysql mariadb admin ui

ansible-role-phpmyadmin's Introduction

Ansible Role: phpMyAdmin

CI

Installs phpMyAdmin on RHEL/CentOS/Debian/Ubuntu.

phpMyAdmin is a simple interface for interacting with MySQL databases via a web browser. It is not necessarily the most secure or efficient method of managing databases, but for those who need a GUI, this one is better than many others. I (geerlingguy) would personally never run it on a production server, nor do I use it myself (I use Sequel Pro or simply interact with the database via CLI/APIs), but it seems many people like it (especially people stuck on a Windows machine with no good MySQL GUIs :).

Requirements

RedHat/CentOS: Requires the EPEL repository on RedHat/CentOS 6.x hosts. You can install the EPEL repository using the geerlingguy.repo-epel role.

Debian/Ubuntu: None.

Role Variables

phpmyadmin_enablerepo: "epel"

(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. remi,remi-php73). This can be handy, as an example, if you want to install the latest version of PHP 7.3 with the latest version of phpMyAdmin, which is in the Remi repository.

phpmyadmin_config_file: /etc/phpmyadmin/config.inc.php

The path to the phpMyAdmin config file.

Available variables are listed below, along with default values (see defaults/main.yml):

phpmyadmin_mysql_host: localhost
phpmyadmin_mysql_port: ""
phpmyadmin_mysql_socket: ""
phpmyadmin_mysql_connect_type: tcp

These variables define the connection method and hostname phpMyAdmin will use to connect to the MySQL server.

phpmyadmin_mysql_user: root
phpmyadmin_mysql_password: "{{ mysql_root_password }}"

The username and password with which phpMyAdmin will attempt to log into the MySQL server. The mysql_root_password should be set as part of the geerlingguy.mysql role, but you can change the user and password to another account entirely, and you most defintely should, especially if you're connecting to a non-development database server!

Dependencies

  • geerlingguy.apache
  • geerlingguy.mysql
  • geerlingguy.php
  • geerlingguy.php-mysql

Example Playbook

- hosts: utility
  vars_files:
    - vars/main.yml
  roles:
    - { role: geerlingguy.phpmyadmin }

Inside vars/main.yml:

phpmyadmin_mysql_user: special_user
phpmyadmin_mysql_password: secure_password_here

TODO

  • Make default configuration more flexible (not everyone wants phpmyadmin to autologin as root).

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-phpmyadmin's People

Contributors

geerlingguy avatar gsfjohnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ansible-role-phpmyadmin's Issues

PhpMyAdmin showing error after clean installation

Hi,

Today I ran into an error after installing phpmyadmin using this ansible role. The error:

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

session_start(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/)

session_start(): Failed to initialize storage module: files (path: )

Used versions:
OS: Ubuntu 20.04
Ansible: 2.10.2

I also used the following roles:
roles:
- geerlingguy.mysql
- geerlingguy.apache
- geerlingguy.php
- geerlingguy.phpmyadmin

I was able to fix the issue with the following tasks:

- name: check phpmyadmin is fixed
      command:
        cmd: "grep -e 'php_admin_value open_basedir .*:/tmp/' /etc/phpmyadmin/apache.conf"
      register: isPhpMyAdminFixed
      ignore_errors: true
    - name: fix phpmyadmin installation
      lineinfile:
        path: "/etc/phpmyadmin/apache.conf"
        state: present
        regexp: 'php_admin_value open_basedir (.*)'
        line: '\tphp_admin_value open_basedir \1:/tmp/'
        backrefs: yes
      when: isPhpMyAdminFixed.failed

It has been a while since I used Ansible, so I don't know if this is the proper way to fix this issue. But at least it fixed my issue.

Debian 10 package status

The phpmyadmin package will most likely not be included in the next Debian release :(

And for the same reason the most prominent ppa(nijel/phpmyadmin) has also been removed.

There is an open pull request that includes installing from source in #13
That PR was focused on nginx so it needs a bit of work to get it working for all debian users.

Two todo's I've identified sofar:

  • missing /etc/apache2/conf-available/phpmyadmin.conf ... we can copy the debian package version
  • add a version check to not re-download pma on every run.

Issue when attempting to modify /etc/phpmyadmin/config.inc.php - Centos7

I am running this role against a Centos7 system:

CentOS Linux release 7.2.1511 (Core)
Linux jul-cap-03 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Using the following roles:

   - role: geerlingguy.mysql
   - role: geerlingguy.apache
   - role: geerlingguy.php
   - role: geerlingguy.php-mysql
   - role: geerlingguy.phpmyadmin

Ansible throws the following error:

TASK [geerlingguy.phpmyadmin : Add default username and password for MySQL connection.] ***
failed: [192.168.12.103] => (item={u'key': u'host', u'value': u'localhost'}) => {"failed": true, "item": {"key": "host", "value": "localhost"}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}
failed: [192.168.12.103] => (item={u'key': u'port', u'value': u''}) => {"failed": true, "item": {"key": "port", "value": ""}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}
failed: [192.168.12.103] => (item={u'key': u'socket', u'value': u''}) => {"failed": true, "item": {"key": "socket", "value": ""}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}
failed: [192.168.12.103] => (item={u'key': u'connect_type', u'value': u'tcp'}) => {"failed": true, "item": {"key": "connect_type", "value": "tcp"}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}
failed: [192.168.12.103] => (item={u'key': u'user', u'value': u'root'}) => {"failed": true, "item": {"key": "user", "value": "root"}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}
failed: [192.168.12.103] => (item={u'key': u'password', u'value': u'RTY452df'}) => {"failed": true, "item": {"key": "password", "value": "RTY452df"}, "msg": "Destination /etc/phpmyadmin/config.inc.php does not exist !", "rc": 257}

It seems the etc directory name has changed. If I update tasks/main.yml and change:
dest=/etc/phpmyadmin/config.inc.php
to
dest=/etc/phpMyAdmin/config.inc.php

everything installs without error.

Remove dependencies

First of all want to say thank you, @geerlingguy, for good roles.

But there is one moment.
Lets imagine that I select not your role to install apache (let say mine).
And if I want to install your phpmyadmin role - I need fork phpmyadmin role, remove unwanted dependencies and even publish it at galaxy.ansible.com to use it in requirements.txt, because otherwise apache role will run twice - one mine and one your from dependencies.

How you think, maybe will be better to delete dependencies from meta and just write about that in README? Or maybe you can advice something?

This question also about many other your roles that have dependencies.
Thak you for answer.

Suggestion: domain-based vhost

A small but useful addition to this really helpful role would be to add a simple vhost to configure an actual domain path to it in stead of or in addition to the fixed /phpmyadmin path.

It would be more logical to visit it at http://phpmyadmin.local or another configurable (by variable) path.

issue package 5.4.16 and 5.4.45

Hello,
Firstly, thank you @geerlingguy :)

I'm trying to build a lamp. Everything fine until I add "geerlingguy.phpmyadmin"
Vagrant OS : geerlingguy/centos7

playbook.yml

    - geerlingguy.firewall
    - geerlingguy.ntp
    - geerlingguy.repo-epel
    - geerlingguy.repo-remi
    - { role: geerlingguy.mysql, become: yes}
    - geerlingguy.apache
    - geerlingguy.php
    - geerlingguy.php-mysql
    - geerlingguy.git
    - geerlingguy.composer
    - geerlingguy.phpmyadmin

my php_packages:

  - php
  - php-cli
  - php-common
  - php-devel
  - php-gd
  - php-mbstring
  - php-pdo
  - php-pecl-apcu
  - php-xml
  - php-bcmath
  - php-mysql
  1. sudo ansible-galaxy install -r requirements.yml --force
  2. vagrant up

step 2 at the end:

TASK [geerlingguy.phpmyadmin : Ensure PHPMyAdmin is installed.] **************** fatal: [lamp]: FAILED! => {"changed": true, "failed": true, "msg": "Error: Package: php-process-5.4.16-36.1.el7_2.1.x86_64 (updates)\n Requires: php-common(x86-64) = 5.4.16-36.1.el7_2.1\n Installed: php-common-5.4.45-11.el7.remi.x86_64 (@remi)\n php-common(x86-64) = 5.4.45-11.el7.remi\n Available: php-common-5.4.16-36.el7_1.x86_64 (base)\n php-common(x86-64) = 5.4.16-36.el7_1\n Available: php-common-5.4.16-36.1.el7_2.1.x86_64 (updates)\n php-common(x86-64) = 5.4.16-36.1.el7_2.1\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: centos.quelquesmots.fr\n * epel: mirror.ibcp.fr\n * extras: centos.quelquesmots.fr\n * remi-safe: remi.mirror.ate.info\n * updates: centos.quelquesmots.fr\nResolving Dependencies\n--> Running transaction check\n---> Package phpMyAdmin.noarch 0:4.4.15.7-1.el7 will be installed\n--> Processing Dependency: php-tcpdf-dejavu-sans-fonts for package: phpMyAdmin-4.4.15.7-1.el7.noarch\n .....

Can you help me please ?

Tanguy

nginx compatibility.

I've been using this one a while now, but I keep running into the problem of not being able to use it unless apache is installed despite having a bolt-on nginx vhost fix.

It would be best for everybody to add on support for nginx.

I assume you'd be for the idea, but feel free not to.

[BUG] install lacks libapache2-mod-php7.0

On a debian stretch on a proxmox LXC, the installation is not completed: the http://<server>/phpmyadmin page shows the php code, not the phpmyadmin login.

This is due to the lack of the package libapache2-mod-php7.0 which is needed to have the php interpreter in apache.

On another hand, on debian buster, the php role fails when it tries to install php7.0 when default in buster is 7.3.

By the way, thanks a lot for all your good roles in ansile galaxy.

php code not executed

Hi,
I use the following playbook

---
- name: Setup container
  hosts: mysql-server-test
  become: true
  pre_tasks:
    - name: Update apt cache.
      apt: 
        update_cache: true
        cache_valid_time: 600
  roles:
    - role: geerlingguy.apache
    - role: geerlingguy.mysql
    - role: geerlingguy.php
    - role: geerlingguy.php-mysql
    - role: geerlingguy.phpmyadmin

to provision my fresh Ubuntu 20.04.4 instance. Provisioning shows no errors, MySQL seems to work properly, Apache as a webserver for html pages works properly.
But when I try to open path /phpadmin on my server, PHP code is just shown but not executed. Same of course for simple phpinfo-scripts.

Here are my role versions:

  • geerlingguy.php, 4.8.0
  • geerlingguy.phpmyadmin, 1.3.3
  • geerlingguy.php-mysql, 2.1.0
  • geerlingguy.apache, 3.2.0
  • geerlingguy.mysql, 3.3.2

I use ansible core 2.12.3.

Although I tried various suggestions found I cannot make it work.
Thanks a lot for any advice.

Regards, Max.

phpmyadmin | Install vHost file failled

This is what I get

failed: [ktm35.gre.hpecorp.net] => {"failed": true, "path": "/etc/httpd/conf.d/phpmyadmin.conf", "state": "absent"}
msg: file (/etc/httpd/conf.d/phpmyadmin.conf) is absent, cannot continue

In the playbook to get it works, I switched from file to copy

Before:

- name: Install vHost file.
  file: src=phpmyadmin.conf dest=/etc/httpd/conf.d/phpmyadmin.conf

After

- name: Install vHost file.
  copy: src=phpmyadmin.conf dest=/etc/httpd/conf.d/phpmyadmin.conf

PHP Apache module not being used in 7.0

When running on the geerlingguy/ubuntu1604 Vagrant box, ran into an issue where the PHP code was simply appearing in the browser instead of being interpreted. I added the following task to my Playbook and it worked without issue:

  tasks:
    - name: Update php module
      apt: name=libapache2-mod-php7.0 state=installed
      notify: restart apache

Issue with phpmyadmin prefs table

I get this error when trying to browse a table in phpmyadmin:

SELECT `prefs`
FROM `phpmyadmin`.`pma_table_uiprefs`
WHERE `username` = 'root'
AND `db_name` = 'symfony'
AND `table_name` = 'users'

MySQL reports: #1146 - Table 'phpmyadmin.pma_table_uiprefs' doesn't exist

This might be an Ubuntu-wide issue http://stackoverflow.com/questions/20731487/phpmyadmin-pma-table-uiprefs-doesnt-exist

I was able to fix it by using the interactive setup:
sudo dpkg-reconfigure phpmyadmin

Tested on Ubuntu 14.04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.