Managing MySQL
MySQL is a very widely used database server, and it's fairly certain you'll need to install and configure a MySQL server at some point. This recipe will show you how to do that, as well as how to automatically create databases and users for apps.
How to do it…
Follow these steps to create the example:
Run the following commands:
ubuntu@cookbook:~/puppet$ mkdir -p modules/mysql/manifests ubuntu@cookbook:~/puppet$ mkdir -p modules/mysql/files
Create the file
modules/mysql/manifests/server.pp
with the following contents:# Manage MySQL server class mysql::server { $password = 'sekrit' $version = 'mysql-server' package { $version: ensure => installed } service { 'mysql': ensure => running, enable => true, require => Package[$version], } file { '/etc/mysql/my.cnf': source => 'puppet:///modules/mysql/my.cnf', owner => 'mysql', group => 'mysql', notify => Service['mysql'], require => Package[$version]...