Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Pages

Thursday, September 06, 2012

Puppet and exported resources

I've recently started using puppet for the european project Open-DAI I'm working on and I can say that after a steep learning period the tool is really nice.

I expecially like the exported resources that allow for "piloting" the creation of resources on a remote node from a first node.

The use case is installing stuff like a DB on a remote DB host for the application we are installing.
My example case is Zabbix.
I want to install zabbix in a distributed configuration using an existing MySQL server I have on the cloud and placing the application on a new cloud host.

Usually all the example and modules I find around imply to have all the stuff on the same host.

The idea id to declare on the application node the fact that you need a DB and to transform this declaration to a command execution on the Db to provision the required DB.

I'm using puppet 3.0.rc4 and opting to use puppet-mysql from puppetlabs (I must say that there is a bit of jungle on the puppet modules around and prefer to stick and possibly contribute to the puppetlabs collection)

The solution I found is to use exported resources on the application node and collecting them on the DB node in this way


In the zabbix host

...
@@mysql::db { zabbix1:
user => 'zabbix1',
password => 'mypass',
host => $::fqdn,
grant => ['all'],
tag => 'new_db_nodeDBname'
}
...

On the MySQL node

...
class { 'mysql::server':
config_hash => {root_password => 'changeme',}
}
Mysql::Db <<| tag == 'new_db_nodeDBname' |>>
...

Now I'll have to solve the orchestration and piloting of the whole process that is after created the DB I'll have to issue a sql creation and to do so I'll need to be sure to have the DB installed so this will require to:
force a puppet agent execution on the MySQL node (possibly using mcollective)
a second run of the puppect agent on the zabbix node to check the availability of the DB and proceed with the installation.

In any case a nice start.

1 commenti:

Blogger said...
This comment has been removed by a blog administrator.