1 # == Definition: openstacklib::db::mysql
3 # This resource configures a mysql database for an OpenStack service
8 # Password hash to use for the database user for this service;
12 # The name of the database
13 # string; optional; default to the $title of the resource, i.e. 'nova'
16 # The database user to create;
17 # string; optional; default to the $title of the resource, i.e. 'nova'
20 # The IP address or hostname of the user in mysql_grant;
21 # string; optional; default to '127.0.0.1'
24 # The charset to use for the database;
25 # string; optional; default to 'utf8'
28 # The collate to use for the database;
29 # string; optional; default to 'utf8_general_ci'
32 # Additional hosts that are allowed to access this database;
33 # array or string; optional; default to undef
36 # Privileges given to the database user;
37 # string or array of strings; optional; default to 'ALL'
39 define openstacklib::db::mysql (
45 $collate = 'utf8_general_ci',
50 include ::mysql::client
52 mysql_database { $dbname:
56 require => [ Class['mysql::server'], Class['mysql::client'] ],
59 $allowed_hosts_list = unique(concat(any2array($allowed_hosts), [$host]))
60 $real_allowed_hosts = prefix($allowed_hosts_list, "${dbname}_")
62 openstacklib::db::mysql::host_access { $real_allowed_hosts:
64 password_hash => $password_hash,
66 privileges => $privileges,