summaryrefslogtreecommitdiff
path: root/manifests/puppetmaster/hasdb/mysql.pp
blob: 1ed122a21c9630a5567c3b7b0a8be6ab88db73fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# don't use this define use the general interface
define puppet::puppetmaster::hasdb::mysql (
  $dbname = 'puppet',
  $dbhost = 'localhost',
  $dbhostfqdn = "${fqdn}",
  $dbuser = 'puppet',
  $dbpwd,
  $dbconnectinghost = 'localhost' )
{
  @@mysql_database { $dbname:
    tag => "mysql_${dbhostfqdn}",
  }

  @@mysql_user { "${dbuser}@${dbconnectinghost}":
    password_hash => mysql_password("$dbpwd"),
    require => Mysql_database[$dbname],
    tag => "mysql_${dbhostfqdn}",
  }

  @@mysql_grant { "${dbuser}@${dbconnectinghost}/${dbname}":
    privileges => all,
    require => Mysql_user["${dbuser}@${dbconnectinghost}"],
    tag => "mysql_${dbhostfqdn}",
  }

  if $use_munin {
    munin::plugin::deploy { 'puppetresources':
      source => "puppet/munin/puppetresources.mysql",
      config => "env.mysqlopts --user=$dbuser --password=$dbpwd -h $dbhost\nenv.puppetdb $dbname",
    }
  }
}