FAQ
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',
}
}

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[gxuser@db.demo.com] 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

--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Llowder at Mar 21, 2013 at 12:49 pm

    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[gxu...@db.demo.com <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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Calvin Walton at Mar 21, 2013 at 1:02 pm

    On Thu, 2013-03-21 at 03:37 -0700, 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',
    }
    }

    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.
    The current git version of the mysql module has a fix for this error:
    https://github.com/puppetlabs/puppetlabs-mysql/commit/1d6ca771d480e756cfdc5f84d73ef2d49f08ba38
    but it has not yet been released. In the mean time, you can separately
    use the underlying resources: (The mysql::db type is just a
    convenience), just add additional 'database' and 'database_grant'
    resources as needed:

    database { 'vidispine':
    ensure => 'present',
    charset => 'utf-8',
    provider => 'mysql',
    require => Class['mysql::server'],
    }

    database_user { 'user@example.com':
    ensure => 'present',
    password_hash => mysql_password('user123'),
    provider => 'mysql',
    require => Database['vidispine'],
    }

    database_grant { 'user@example.com/vidispine':
    privileges => 'all',
    provider => 'mysql',
    require => Database_user['user@example.com'],
    }

    --
    Calvin Walton <calvin.walton@kepstin.ca>
  • Jithin Xavier at Mar 25, 2013 at 10:06 am
    Thanks Calvin, It is working for me now. There is another issue which I
    noticed in Mysql is, I have set the root password in config.pp as below.

    class mysql::config(
    * $root_password = 'Pa$$word!',*
    $old_root_password = '',
    $bind_address = $mysql::params::bind_address,
    $port = $mysql::params::port,
    $etc_root_password = $mysql::params::etc_root_pass

    and server.pp as

    class mysql::server (
    $package_name = $mysql::params::server_package_name,
    $package_ensure = 'present',
    $service_name = $mysql::params::service_name,
    $service_provider = $mysql::params::service_provider,
    * $config_hash = { 'root_password' => 'Pa$$word!'}*,
    $enabled = true,
    $manage_service = true
    ) inherits mysql::params {

    issues which I am facing here is ,when I type mysql command and enter
    without asking credetial its is going to mysql console. If trued with mysql
    -u root -p Pa$$word!, and its working as well..How can I restrict that
    mysql command enter to without credential to console?

    Thanks,
    Jithin


    On Thu, Mar 21, 2013 at 6:32 PM, Calvin Walton wrote:
    On Thu, 2013-03-21 at 03:37 -0700, 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',
    }
    }

    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.
    The current git version of the mysql module has a fix for this error:

    https://github.com/puppetlabs/puppetlabs-mysql/commit/1d6ca771d480e756cfdc5f84d73ef2d49f08ba38
    but it has not yet been released. In the mean time, you can separately
    use the underlying resources: (The mysql::db type is just a
    convenience), just add additional 'database' and 'database_grant'
    resources as needed:

    database { 'vidispine':
    ensure => 'present',
    charset => 'utf-8',
    provider => 'mysql',
    require => Class['mysql::server'],
    }

    database_user { 'user@example.com':
    ensure => 'present',
    password_hash => mysql_password('user123'),
    provider => 'mysql',
    require => Database['vidispine'],
    }

    database_grant { 'user@example.com/vidispine':
    privileges => 'all',
    provider => 'mysql',
    require => Database_user['user@example.com'],
    }

    --
    Calvin Walton <calvin.walton@kepstin.ca>


    --
    -Regards
    Jithin Xavier
    +91-9739505163
    Skype- jithinxavi
    in.linkedin.com/in/jithinxavier/

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Felix Frank at Mar 25, 2013 at 11:09 am

    On 03/25/2013 11:06 AM, Jithin Xavier wrote:
    If trued with mysql -u root -p Pa$$word!, and its working as well
    Hmm, that looks wrong. There must be no space between -p and the
    password, otherwise the mysql command will interpret the latter as the
    database to use, not the password.

    Try "mysql -u root -p".

    Anyway, it may be that there is a root account in your database with no
    password. Try 'select user,host,password from mysql.user;'

    HTH,
    Felix

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jithin Xavier at Mar 25, 2013 at 11:18 am
    No, this is not my issue "mysql -u root -p" , My problem is ,if I type
    mysql command and enter,its going to mysql console with out giving me
    error,I am expecting some error here because I have set root credentials.



    On Mon, Mar 25, 2013 at 4:39 PM, Felix Frank wrote:
    On 03/25/2013 11:06 AM, Jithin Xavier wrote:
    If trued with mysql -u root -p Pa$$word!, and its working as well
    Hmm, that looks wrong. There must be no space between -p and the
    password, otherwise the mysql command will interpret the latter as the
    database to use, not the password.

    Try "mysql -u root -p".

    Anyway, it may be that there is a root account in your database with no
    password. Try 'select user,host,password from mysql.user;'

    HTH,
    Felix

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "Puppet Users" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/puppet-users/HGWxMrC63nc/unsubscribe?hl=en
    .
    To unsubscribe from this group and all its topics, send an email to
    puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    -Regards
    Jithin Xavier
    +91-9739505163
    Skype- jithinxavi
    in.linkedin.com/in/jithinxavier/

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Felix Frank at Mar 25, 2013 at 11:23 am
    Then read again, please.
    On 03/25/2013 12:18 PM, Jithin Xavier wrote:
    No, this is not my issue "mysql -u root -p" , My problem is ,if I type
    mysql command and enter,its going to mysql console with out giving me
    error,I am expecting some error here because I have set root credentials.

    Anyway, it may be that there is a root account in your database with no
    password. Try 'select user,host,password from mysql.user;'
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 21, '13 at 10:37a
activeMar 25, '13 at 11:23a
posts7
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase