Using Vagrant VMs for Drupal development is quite useful and offers many advantages. Since a very common tool for doing dev tasks is phpMyAdmin, it's a good idea to set it up with auto-login when provisioning the dev VM. Since I didn't find this explicitly done anywhere on the net, I worked a bit on getting it done and found a method that should be relatively easy to implement.
First of all, remember: this is intended to be used exclusively on a private dev environment. Do this under your sole responsibility.
This is the code:
# This assumes php5 and mysql-server are installed somewhere else in the puppet manifests.
package { phpmyadmin:
ensure => installed,
require => Package['php5', 'mysql-server']
}
# Enable access via /phpmyadmin
# This assumes apache is installed somewhere else in the Puppet manifests
file { '/etc/apache2/sites-enabled/phpmyadmin':
ensure => 'present',
content => 'include /etc/phpmyadmin/apache.conf',
mode => 644,
require => [
Class['apache::mod::php'],
Package['phpmyadmin']
]
}
# Remove config if it does not include auto-login options
exec { 'remove-non-autologin-config':
command => 'sudo rm /etc/phpmyadmin/config.inc.php',
unless => 'grep "Enable auto-login" /etc/phpmyadmin/config.inc.php',
path => ['/bin/', '/usr/bin/'],
notify => Exec['download-autologin-config'],
}
# Download gist including auto-login config options. root/root are the assumed credentials
# This assumes wget is installed somewhere else in the Puppet manifests
exec { 'download-autologin-config':
command => 'sudo wget https://gist.github.com/jedihe/6117009/raw/50c64759de0c0b118d785601af88d268822cd828/config-3.4.10.1deb1.inc.php -O /etc/phpmyadmin/config.inc.php',
require => [Package['wget'], Exec['remove-non-autologin-config']],
creates => '/etc/phpmyadmin/config.inc.php',
path => ['/bin/', '/usr/bin/'],
}
Once the provisioning is done, phpMyAdmin should be accessible at domain/phpmyadmin and it should not prompt for credentials. An extra helper can be creating a bookmark in the form domain/phpmyadmin/index.php?db=db_name, where domain and db_name must be replaced with the corresponding values for the given use case.
Notice the gist with the modified file includes the version it works with; if the config file for phpMyAdmin changes, it's just a matter of re-creating the auto-login config from the default file, uploading it to a new file in the gist and then updating the Puppet manifest accordingly.
As a final note, please keep in mind I do not pretend to be a Puppet expert; the provided code is shared only in the hope it would be of help for a developer wanting to get auto-login easily and consistently on the dev environment.
Using Vagrant VMs for Drupal development is quite useful and offers many advantages. Since a very common tool for doing dev tasks is phpMyAdmin, it's a good idea to set it up with auto-login when provisioning the dev VM. Since I didn't find this explicitly done anywhere on the net, I worked a bit on getting it done and found a method that should be relatively easy to implement.
Update: This is part of my Vagrant powered Drupal dev VM.
First of all, remember: this is intended to be used exclusively on a private dev environment. Do this under your sole responsibility.
This is the code:
Once the provisioning is done, phpMyAdmin should be accessible at domain/phpmyadmin and it should not prompt for credentials. An extra helper can be creating a bookmark in the form domain/phpmyadmin/index.php?db=db_name, where domain and db_name must be replaced with the corresponding values for the given use case.
Notice the gist with the modified file includes the version it works with; if the config file for phpMyAdmin changes, it's just a matter of re-creating the auto-login config from the default file, uploading it to a new file in the gist and then updating the Puppet manifest accordingly.
As a final note, please keep in mind I do not pretend to be a Puppet expert; the provided code is shared only in the hope it would be of help for a developer wanting to get auto-login easily and consistently on the dev environment.