On Thursday, March 21, 2013 5:37:35 AM UTC-5, Jithin Xavier wrote:
>
> Hello All,
>
> I wanted to create two two MySQL database with same user credential using 
> Puppet-MySQL. How can I achieve this? Please find my script below.
>
> class mysql::vsdatabase {
>  include mysql
>  mysql::db { 'vidispine':
>  user => 'user',
>  password => 'user123',
>  host => 'db.<hostname>.com',
> }
> }
>

Use a define[1] to create the database rather than a class. Classes are 
singletons, so you can only use them once per catalog (node). 

By using a define, you can pull the data from a wrapper class param or 
hiera, and then just call the define twice with different namevar but the 
same user & pass.


> How can I add another database here with same credential.(If I create 
> different Class with different database and same credential I am getting 
> below error.
> root@demo:/mnt# puppet agent -t
> info: Retrieving plugin
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/concat_basedir.rb
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/puppet_vardir.rb
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/root_home.rb
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/iptables.rb
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/pe_version.rb
> info: Loading facts in 
> /var/opt/lib/pe-puppet/lib/facter/custom_auth_conf.rb
> info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/facter_dot_d.rb
> err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
> Duplicate declaration: Database_user[[email protected] <javascript:>] is 
> already declared in file 
> /etc/puppetlabs/puppet/modules/mysql/manifests/db.pp at line 62; cannot 
> redeclare at /etc/puppetlabs/puppet/modules/mysql/manifests/db.pp:62 on 
> node demo
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run
> )
>
> Thanks,
> Jithin Xavier
>


[1]  http://docs.puppetlabs.com/puppet/3/reference/lang_defined_types.html

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to