Quantcast
Channel: El blog de Deigote » mysql
Viewing all articles
Browse latest Browse all 3

MySQL Puppet module

$
0
0

This is an english version of the post I published in Mindfood in Spanish.

Carrying on with the Puppet modules that we have published on OSOCO’s Github account, today I’ll describe the Puppet MySQL module, which I have found to be one of the most useful when creating our infrastructures :-) .

There are tons of Mysql modules out there, but the ones I tried before creating one ourselves were too powerful, hence too complex and with lots of dependencies. In this case, I wanted to aim for exactly the opposite: a simple module that just works for doing the most common MySQL tasks: install, set root password, create databases and grant user with access to them.

So, for using the module you just have to add it to your modules (we use Puppet Librarian for dependencies management) and declare the resources that you need. The following example shows our MySQL configuration for the node that is responsible of hosting Jenkins:

class ci_mysql {

    mysql::database { 'someProjectTestDB': }
    mysql::database { 'anotherProjectTestDB': }

    $test_user_name = 'test'
    $test_user_pwd = 'test'

    mysql::user { 'someProjectTestDB-test-user':
        user => "$test_user_name",
        password => "$test_user_pwd",
        database => 'someProjectTestDB',
        host => '%'
    }

    mysql::user { 'anotherProjectTestDB-test-user':
        user => "$test_user_name",
        password => "$test_user_pwd",
        database => 'anotherProjectTestDB',
        host => '%'
    }

    mysql::user { 'anotherProjectTestDB-readonly-user':
        user => 'readonlyuser',
        password => 'readonlyuser',
        database => 'anotherProjectTestDB',
        privileges => 'SELECT'
    }
}

Just like that, MySQL server will be installed and launch as a service. Also, two databases will be created (someProjectTestDB and anotherProjectTestDB) with a full privileged user (test). Last, readonlyuser user will have access to anotherProjectTestDB, but will only be able to perform select queries. Plain and easy :-) .

The class can also configured with the following optional parameters:

class ci_mysql {
   class { "mysql::install":
      version => "5.1.61-0+squeeze1",
      root_pwd => "myFancyRootPassword",
      data_dir => "/mnt/mysql/datadir",
   }   
   ...
}

That way, you can specify the MySQL version, the root password and the data dir where the data will be put. Last, but not least, this module has been tested in both our Debian and Gentoo servers (so it should work also with Ubuntu).


Viewing all articles
Browse latest Browse all 3

Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Long Distance Relationship Tagalog Love Quotes


Tagalog Long Distance Relationship Love Quotes


Winx Club para colorear


Girasoles para colorear


Sapos para colorear


Vacas para colorear


Dromedario para colorear


Love Quotes Tagalog


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal


Pangarap Quotes


Gwapo Quotes : Babaero Quotes


Libros para colorear


Mandalas de flores para colorear


Dibujos para colorear de perros


Renos para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


RE: Mutton Pies (mely)


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Amarula African Gin





Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC