puppet, mysql managen

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • Boudewijn
  • Registratie: Februari 2004
  • Niet online

Boudewijn

omdat het kan

Topicstarter
Hoihoi

Ik heb een puppetdoos (debian) met wat clients (debian) waar ik mysql op wil managen.
Deze module is geinstalleerd middels:
code:
1
puppet module install puppetlabs/mysql

Ik draai een pluginsync=true optie op zowel clients als server.

Als ik de manual (README.md) erbij pak:
# Mysql module for Puppet

This module manages mysql on Linux (RedHat/Debian) distros. A native mysql provider implements database resource type to handle database, database user, and database permission.

Pluginsync needs to be enabled for this module to function properly.
Read more about pluginsync in our [docs](http://docs.puppetlabs.co....html#enabling-pluginsync)

## Description

This module uses the fact osfamily which is supported by Facter 1.6.1+. If you do not have facter 1.6.1 in your environment, the following manifests will provide the same functionality in site.pp (before declaring any node):

if ! $::osfamily {
case $::operatingsystem {
'RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL': {
$osfamily = 'RedHat'
}
'ubuntu', 'debian': {
$osfamily = 'Debian'
}
'SLES', 'SLED', 'OpenSuSE', 'SuSE': {
$osfamily = 'Suse'
}
'Solaris', 'Nexenta': {
$osfamily = 'Solaris'
}
default: {
$osfamily = $::operatingsystem
}
}
}

This module depends on creates_resources function which is introduced in Puppet 2.7. Users on puppet 2.6 can use the following module which provides this functionality:

[http://github.com/puppetlabs/puppetlabs-create_resources](http://github.com/puppetlabs/puppetlabs-create_resources)

This module is based on work by David Schmitt. The following contributor have contributed patches to this module (beyond Puppet Labs):

* Christian G. Warden
* Daniel Black
* Justin Ellison
* Lowe Schmidt
* Matthias Pigulla
* William Van Hevelingen
* Michael Arnold

## Usage

### mysql
Installs the mysql-client package.

class { 'mysql': }

### mysql::java
Installs mysql bindings for java.

class { 'mysql::java': }

### mysql::python
Installs mysql bindings for python.

class { 'mysql::python': }

### mysql::ruby
Installs mysql bindings for ruby.

class { 'mysql::ruby': }

### mysql::server
Installs mysql-server packages, configures my.cnf and starts mysqld service:

class { 'mysql::server':
config_hash => { 'root_password' => 'foo' }
}

Database login information stored in `/root/.my.cnf`.

### mysql::db
Creates a database with a user and assign some privileges.

mysql::db { 'mydb':
user => 'myuser',
password => 'mypass',
host => 'localhost',
grant => ['all'],
}

### mysql::backup
Installs a mysql backup script, cronjob, and priviledged backup user.

class { 'mysql::backup':
backupuser => 'myuser',
backuppassword => 'mypassword',
backupdir => '/tmp/backups',
}

### Providers for database types:
MySQL provider supports puppet resources command:

$ puppet resource database
database { 'information_schema':
ensure => 'present',
charset => 'utf8',
}
database { 'mysql':
ensure => 'present',
charset => 'latin1',
}

The custom resources can be used in any other manifests:

database { 'mydb':
charset => 'latin1',
}

database_user { 'bob@localhost':
password_hash => mysql_password('foo')
}

database_grant { 'user@localhost/database':
privileges => ['all'] ,
# Or specify individual privileges with columns from the mysql.db table:
# privileges => ['Select_priv', 'Insert_priv', 'Update_priv', 'Delete_priv']
}

A resource default can be specified to handle dependency:

Database {
require => Class['mysql::server'],
}
Werkt best goed qua users, maar ik mis eea, zoals databases aanmaken:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
node 'mysql.XXX.nl' inherits basenode {

 
    class { 'mysql::server':
      config_hash => { 'root_password' => 'foo' }
    }
    class { 'mysql': }
    class { 'mysql::java': }


mysql::db { 'mydatabase':
  user     => 'myapp1',
  password => 'supersecret',
  host     => 'webapp1.puppetlabs.com',
}

}


Ook als ik de resources op probeer te vragen (in de demo staat hij met kleine letters maar als je een resource type zoals User opvraagt, moet dat met hoofdletters).
code:
1
2
3
4
root@mysql:~# puppet resource Database
Could not run: Could not find type Database
root@mysql:~# puppet resource database
Could not run: Could not find type database



Deze heb ik uiteraard ook gelezen:
https://puppetlabs.com/bl...s-mysql-mysql-management/


Als ik echter puppet aanzet op de client zie ik dat het rootpassword wordt gezet (ook in /root/.my.cnf )maar dat er geen DB wordt gemaakt.
Weet iemand wat ik fout doe?
code:
1
2
3
4
root@mysql:~# mysql -u root -pfoo
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 631
Server version: 5.5.31-0+wheezy1 (Debian)

Werkt gewoon....
code:
1
2
3
4
5
root@mysql:~# cat /root/.my.cnf
[client]
user=root
host=localhost
password=foo

Ziet er ook weer prima uit. Waarom faalt het aanmaken van die DB, en die resource commando's?

i3 + moederbord + geheugen kopen?


Acties:
  • 0 Henk 'm!

  • Boudewijn
  • Registratie: Februari 2004
  • Niet online

Boudewijn

omdat het kan

Topicstarter
Niemand ervaring met deze module, danwel een andere module voor MySQL?

i3 + moederbord + geheugen kopen?


Acties:
  • 0 Henk 'm!

  • Boudewijn
  • Registratie: Februari 2004
  • Niet online

Boudewijn

omdat het kan

Topicstarter
En opgelost; het komt doordat ik de pluginsync = true in /etc/default/puppet had gezet, in plaats van /etc/puppet/puppet.conf.
Zodra je daara een update draait gaat hij al die plugin shizzle filebucketen... heel mooi.
En toen werkte het :).

i3 + moederbord + geheugen kopen?