[Puppet Users] Management of MySQL grant tables?

3,095 views
Skip to first unread message

dbs

unread,
May 19, 2010, 10:56:09 AM5/19/10
to Puppet Users
We need to make sure all our MySQL servers have a specific user /
password / grant setup available (this is because we use centralized
monitoring via Zenoss, and Zenoss needs a login on all the servers).

I found a github reference to a package that might do it (
http://github.com/camptocamp/puppet-mysql ) but I can't understand
what it is, how it works, or even what to do with it.

How would folks recommend implementing this functionality?

(Talking about perhaps 40 database servers)

-d

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Ken

unread,
May 19, 2010, 11:44:36 AM5/19/10
to Puppet Users
> I found a github reference to a package that might do it (http://github.com/camptocamp/puppet-mysql) but I can't understand
> what it is, how it works, or even what to do with it.

Hmm. How familiar are you with puppet modules? Not quite clear how
detailed we need to be here :-). Here is a doc that outlines them:
http://docs.puppetlabs.com/guides/modules.html

Ordinarily you would drop this code into your 'module path' (by
default this is often /etc/puppet/modules). This would make it
available then for use in other code/manifests.

Assuming you are already okay with these aspects of puppet - here is a
sample manifest on how to use it for 1 system. I have a fork of that
code (its been around - I'm not even clear who wrote it first - could
have been David Schmidt: http://git.black.co.at/?p=module-mysql;a=summary)
so it may not work exactly the same :-).

mysql_database {
"drupal":
ensure => present;
"bugzilla":
ensure => present;
"wpmu":
ensure => present;
}
mysql_user {
"drupal@localhost":
password_hash => mysql_password("foo");
"bugzilla@localhost":
password_hash => mysql_password("foo");
"wpmu@localhost":
password_hash => mysql_password("foo");
}
mysql_grant {
"drupal@localhost/drupal":
privileges => [
"select_priv", "insert_priv",
"update_priv", "delete_priv",
"create_priv", "drop_priv",
"index_priv", "alter_priv",
],
require => Mysql_user["drupal@localhost"];
"bugzilla@localhost/bugzilla":
privileges => [
"select_priv", "insert_priv",
"update_priv", "delete_priv",
"create_priv", "drop_priv",
"index_priv", "alter_priv",
],
require => Mysql_user["bugzilla@localhost"];
"wpmu@localhost/wpmu":
privileges => [
"select_priv", "insert_priv",
"update_priv", "delete_priv",
"create_priv", "drop_priv",
"index_priv", "alter_priv",
],
require => Mysql_user["wpmu@localhost"];
}

This would in effect:

* create 3 databases - drupal, bugzilla, wpmu
* create 3 users - drupal, bugzilla, wpmu
* assign grant access for the users to the db's of the same name

ken.

jb

unread,
May 20, 2010, 12:45:56 PM5/20/10
to Puppet Users
I've setup something where I put a grants file in the data directory
of each database:

remotefile {"$db_datadir/grants":
mode => 500,
source => "db/$db_name/data/grants",
require => File["${db_datadir}"],
notify => Exec["refresh_${db_name}"]
}

this file contains...grants, ala:

--
delete from mysql.user where not(user='root' and host='localhost');


grant select on mydb.* to 'imyuser'@'%' identified by PASSWORD
'*NOTREALNOTREAL727A331289600B9AA66EAE';
<additional grants as needed>


flush privileges
--

from there every time puppet is run it dumps all grants and does an
md5 hash. if the hash is ever different from the previously computed
hash (stored in a file), it reapplies the grants. Basically if
anybody makes a manual change it will get reverted next puppet run.
hopefully someone doesn't poke a hole in my logic here, but it seems
to work fine for me. The only change I've been thinking I should put
in is having the initial 'delete' and final 'flush' statements part of
the actual puppet class instead of in each grants file. it'd be
safer..


# generate a hash from the grants table. if it's different than
the hash generated last time
# notify so grants table gets refreshed.
# this will backout changes made manually!
$grants_sel = "'select user,host,password from mysql.user order
by user,host;'"

exec {"echo ${grants_sel} | ${mysql_bin}/mysql -S ${db_socket} |
md5sum > ${db_datadir}/grants.hash":
onlyif => "test -S ${db_socket}",
unless => "echo ${grants_sel} | ${mysql_bin}/mysql -S $
{db_socket} | md5sum | diff - ${db_datadir}/grants.hash",
notify => Exec["refresh_${db_name}"]
}

# refresh only on grants file change. gets notified by grants
file being changed
# NOTE --force means it will apply statements even if a
previous one has a syntax error
# without all lines are applied until the syntax error and lines
after are not
exec {"${mysql_bin}/mysql --force -S ${db_socket} < $db_datadir/
grants":
alias => "refresh_${db_name}",
refreshonly => true,
onlyif => "test -S ${db_socket}",
}





On May 19, 7:56 am, dbs <dbelfershev...@gmail.com> wrote:
> We need to make sure all our MySQL servers have a specific user /
> password / grant setup available (this is because we use centralized
> monitoring via Zenoss, and Zenoss needs a login on all the servers).
>
> I found a github reference to a package that might do it (http://github.com/camptocamp/puppet-mysql) but I can't understand

Christopher Johnston

unread,
Jun 21, 2010, 11:28:21 AM6/21/10
to puppet...@googlegroups.com
Module works great!  Thx!  I made some slight mods to it for my environment but works great.

David Schmitt

unread,
Jun 21, 2010, 11:51:36 AM6/21/10
to puppet...@googlegroups.com
On 5/19/2010 5:44 PM, Ken wrote:
>> I found a github reference to a package that might do it
>> (http://github.com/camptocamp/puppet-mysql) but I can't understand
>> what it is, how it works, or even what to do with it.
>
> Hmm. How familiar are you with puppet modules? Not quite clear how
> detailed we need to be here :-). Here is a doc that outlines them:
> http://docs.puppetlabs.com/guides/modules.html
>
> Ordinarily you would drop this code into your 'module path' (by
> default this is often /etc/puppet/modules). This would make it
> available then for use in other code/manifests.
>
> Assuming you are already okay with these aspects of puppet - here is
> a sample manifest on how to use it for 1 system. I have a fork of
> that code (its been around - I'm not even clear who wrote it first -
> could have been David Schmidt:
> http://git.black.co.at/?p=module-mysql;a=summary) so it may not work
> exactly the same :-).


Indeed, the mysql_* types were originially written by me.


Best Regards, David
--
dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at
Klosterneuburg UID: ATU64260999

FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg

bowlby

unread,
Jul 14, 2010, 8:11:49 AM7/14/10
to Puppet Users
Hi,
I tried the mysq-module (from http://github.com/camptocamp/puppet-mysql)
and it will install mysql but it won't create db's or users.
I had to create /usr/share/augeas/lenses/contrib, because the module
seems to expect it. Otherwise I get no error-logs, it just won't
create users or databases...

I'm running it on Ubuntu Lucid Lynx, puppet 25.4.


Somebody having the same problems?

Thanks!

btw, this is what I use to test:

node 'puppettest' {

include mysql::server

mysql::rights {"Set rights for puppet database":
ensure => present,
database => "puppesdfsdft",
user => "puppesdfsdft@localhost",
password => "puppsdfsdfdsfet"
}

mysql::database{"mysdfsdfsdfdb":
ensure => present

steve .

unread,
Jul 14, 2010, 11:15:21 PM7/14/10
to puppet...@googlegroups.com
If you grab the Augeas module from the same source, that should
satisfy the dependency...

bowlby

unread,
Jul 16, 2010, 3:26:29 PM7/16/10
to Puppet Users
Hi Steve,
Thanks for your suggestion but it doesn't change the behaviour I see.
MySQL gets installed nicely, but the db's do not appear nor any error-
messages in the logfiles.

I use:
node 'puppettest' {

include mysql::server
include augeas

mysql::database {"tsdfsdf": ensure => present,}

}





On Jul 15, 5:15 am, "steve ." <leftath...@gmail.com> wrote:
> If you grab the Augeas module from the same source, that should
> satisfy the dependency...
>
> On Wed, Jul 14, 2010 at 7:11 AM, bowlby <bramenn...@gmail.com> wrote:
> > Hi,
> > I tried the mysq-module (fromhttp://github.com/camptocamp/puppet-mysql)

bowlby

unread,
Jul 16, 2010, 3:29:51 PM7/16/10
to Puppet Users
btw, this is my log:
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/
dscl does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does
not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting
false
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/
lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/
var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/public_keys/puppettest.pem]:
Autorequiring File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/
lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private_keys/puppettest.pem]:
Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs/puppettest.pem]: Autorequiring
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/
lib/puppet]
debug: Finishing transaction -610424768 with 0 changes
debug: Using cached certificate for ca, good until Sun Jul 12 19:07:56
UTC 2015
debug: Using cached certificate for puppettest, good until Sun Jul 12
19:07:56 UTC 2015
debug: Loaded state in 0.01 seconds
info: Retrieving plugin
debug: Using cached certificate for ca, good until Sun Jul 12 19:07:56
UTC 2015
debug: Using cached certificate for puppettest, good until Sun Jul 12
19:07:56 UTC 2015
debug: Using cached certificate_revocation_list for ca, good until
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: Finishing transaction -610639268 with 0 changes
debug: Executing '/etc/puppet/etckeeper-commit-pre'
info: Loading facts in mysql
info: Loading facts in acpi_available
info: Loading facts in munin_interfaces
info: Loading facts in mysql
info: Loading facts in acpi_available
info: Loading facts in munin_interfaces
sh: Syntax error: Bad fd number
debug: catalog supports formats: b64_zlib_yaml marshal pson raw yaml;
using pson
info: Caching catalog for puppettest
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/
pkg_delete does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-
nox does not exist
debug: Puppet::Type::Package::ProviderAptrpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderUrpmi: file rpm does not exist
debug: Puppet::Type::Package::ProviderYum: file rpm does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/emerge
does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does
not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not
exist
debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swlist does
not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgrm does
not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/
portversion does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_delete does
not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not
exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig
does not exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not
exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl
does not exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc
does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update
does not exist
debug: Creating default schedules
debug: Finishing transaction -610106008 with 0 changes
debug: Loaded state in 0.01 seconds
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} $
{Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-
query -W --showformat '${Status} ${Package} ${Version}\n''
debug: //mysql::server/Service[mysql]/require: requires Package[mysql-
server]
debug: //mysql::server/Augeas[my.cnf/mysqld]/require: requires File[/
etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld]/notify: subscribes to
Service[mysql]
debug: //mysql::server/Augeas[my.cnf/replication]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/replication]/notify: subscribes
to Service[mysql]
debug: //mysql::server/File[/root/.my.cnf]/require: requires
Exec[Initialize MySQL server root password]
debug: //mysql::server/Augeas[my.cnf/client]/require: requires File[/
etc/mysql/my.cnf]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
require: requires Package[mysql-server]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
require: requires Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
notify: subscribes to Exec[Generate my.cnf]
debug: //augeas::debian/Package[augeas-tools]/before: requires File[/
usr/share/augeas/lenses/contrib]
debug: //mysql::server/User[mysql]/require: requires Package[mysql-
server]
debug: //mysql::server/File[/var/lib/mysql]/require: requires
Package[mysql-server]
debug: //mysql::server/File[/etc/mysql/my.cnf]/require: requires
Package[mysql-server]
debug: //mysql::server/Augeas[my.cnf/performance]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/performance]/notify: subscribes
to Service[mysql]
debug: //augeas::debian/Package[augeas-lenses]/before: requires File[/
usr/share/augeas/lenses/contrib]
debug: //augeas::debian/Package[libaugeas0]/before: requires File[/usr/
share/augeas/lenses/contrib]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/notify: subscribes
to Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]:
Skipping automatic relationship with File[/root/.my.cnf]
debug: //mysql::server/File[/var/lib/mysql]: Autorequiring User[mysql]
debug: //mysql::server/File[/usr/share/augeas/lenses/contrib/
mysql.aug]: Autorequiring File[/usr/share/augeas/lenses/contrib]
info: Applying configuration version '1279301348'
debug: //mysql::server/File[/etc/mysql/my.cnf]/seltype: SELinux
bindings not found. Ignoring parameter.
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Opening augeas
with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Augeas version
0.7.0 is installed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Will attempt to
save and only run if files changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command
'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/pid-file", "/
var/run/mysqld/mysqld.pid"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command
'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/socket", "/
var/run/mysqld/mysqld.sock"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Skipping becuase
no files were changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/performance](provider=augeas): Opening augeas
with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/performance](provider=augeas): Augeas version
0.7.0 is installed
debug: Augeas[my.cnf/performance](provider=augeas): Will attempt to
save and only run if files changed
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/
max_allowed_packet"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/table_cache"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/read_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/
read_rnd_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/net_buffer_length"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/
myisam_sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/thread_cache_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/query_cache_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/
thread_concurrency"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/thread_stack"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqldump/
max_allowed_packet"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/isamchk/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/isamchk/sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/isamchk/read_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/isamchk/write_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/
sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/read_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/write_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): Skipping becuase
no files were changed
debug: Augeas[my.cnf/performance](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/client](provider=augeas): Opening augeas with
root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/client](provider=augeas): Augeas version 0.7.0 is
installed
debug: Augeas[my.cnf/client](provider=augeas): Will attempt to save
and only run if files changed
debug: Augeas[my.cnf/client](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/client/socket", "/var/run/
mysqld/mysqld.sock"]
debug: Augeas[my.cnf/client](provider=augeas): Skipping becuase no
files were changed
debug: Augeas[my.cnf/client](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/replication](provider=augeas): Opening augeas
with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/replication](provider=augeas): Augeas version
0.7.0 is installed
debug: Augeas[my.cnf/replication](provider=augeas): Will attempt to
save and only run if files changed
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/log-bin"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/server-id"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-host"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-user"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-password"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/report-host"]
debug: Augeas[my.cnf/replication](provider=augeas): Skipping becuase
no files were changed
debug: Augeas[my.cnf/replication](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/mysqld](provider=augeas): Opening augeas with
root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/mysqld](provider=augeas): Augeas version 0.7.0 is
installed
debug: Augeas[my.cnf/mysqld](provider=augeas): Will attempt to save
and only run if files changed
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/pid-file", "/var/run/
mysqld/mysqld.pid"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/old_passwords", "0"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/character-set-server",
"utf8"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/log-warnings", "1"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/log-error", "/var/log/
mysql.err"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/set", "log-slow-
queries"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/mysqld/socket", "/var/run/
mysqld/mysqld.sock"]
debug: Augeas[my.cnf/mysqld](provider=augeas): Skipping becuase no
files were changed
debug: Augeas[my.cnf/mysqld](provider=augeas): Closed the augeas
connection
debug: Service[mysql](provider=debian): Executing 'ps -ef'
debug: Service[mysql](provider=debian): PID is 5658
debug: //mysql::server/Exec[Initialize MySQL server root password]:
Executing check 'test -f /root/.my.cnf'
debug: Executing 'test -f /root/.my.cnf'
debug: //mysql::server/File[/var/lib/mysql]/seltype: SELinux bindings
not found. Ignoring parameter.
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: Finishing transaction -610228298 with 0 changes
debug: Storing state
debug: Stored state in 0.05 seconds
notice: Finished catalog run in 3.43 seconds
debug: Executing '/etc/puppet/etckeeper-commit-post'

steve .

unread,
Jul 16, 2010, 10:50:13 PM7/16/10
to puppet...@googlegroups.com
It looks like mysql::database is not loading at all -- it's being
skipped entirely.

The camptocamp MySQL module relies on a facter plugin *and* a puppet
plugin for its functionality.

In order for this to work, you have to ensure that the plugins
propagate from the Puppetmaster to the client. I scratched (banged)
my head on this one for a while until I ran the Puppet daemon on my
Puppetmaster. It said, "Ooh, plugins!!!" and copied them all from
their respective module directories into
/var/lib/puppet/lib/puppet/[parser,provider,type] and everything
suddenly started working on the next go-round.

In retrospect, this makes sense since the Puppetmaster's the one
generating these manifests, and if it doesn't know about the plugins
it can't parse the manifests fully. But on the other hand, it makes
no sense that the Puppetmaster relies on a run of the Puppet daemon in
order to get things placed in the right section of the hierarchy.

So I suggest that you make sure that you have the mysql_*.rb types,
providers and parsers in your client *and* puppetmaster's libdir.
Running puppet on my puppetmaster made things a bit wonky for me as
I'd been making a lot of config tweaks to get everything up and
running without keeping manifests up to date. So yeah, that kind of
clobbered some of my puppetmaster configs and I had to rebuild a bit.

Hope this helps. FWIW, I am using this module on CentOS and it's
working for me, so just hang in there -- you'll get it!

bowlby

unread,
Jul 17, 2010, 11:17:59 AM7/17/10
to Puppet Users
Hi Steve,

Thanks for your pointers, although still with no results (which
probably is the fault of my still meager puppet-knowledge)...

Indeed the libs weren't copied to /var/lib/puppet/lib/* but doing so
did not solve the problem: still no db gets created, still no errors
in the logfile.

I'm testing puppet and puppetmaster on the same (virtual)machine.
I issue: 'puppetd --test --server puppettest --trace --debug' to test
my setup.

Using a different virtual machine as a client (so not running puppet
and puppetmaster on the same machine) didn't help either.


Any more suggestions left?
> ...
>
> read more »

steve .

unread,
Jul 19, 2010, 12:17:18 PM7/19/10
to puppet...@googlegroups.com
Hmm. Usually I run my clients with --verbose as well for debugging,
but I'm not sure that's relevant. I did a test run just now on a
client that uses the MySQL module and it printed out debug data for
the MySQL provider.

I get the following after the configuration is retrieved from the
Puppetmaster and before the line, "info: Applying configuration
version '${TIMESTAMP}'" :


debug: Creating default schedules


debug: Loaded state in 0.01 seconds

debug: Prefetching mysql resources for mysql_database
debug: Puppet::Type::Mysql_database::ProviderMysql: Executing
'/usr/bin/mysql mysql -NBe 'show databases''
debug: Prefetching mysql resources for mysql_user
debug: Puppet::Type::Mysql_user::ProviderMysql: Executing
'/usr/bin/mysql mysql -NBe 'select concat(user, "@", host), password
from user''
debug: Prefetching parsed resources for ssh_authorized_key
debug: Prefetching yum resources for package

Do you have the mysql client installed on that machine?

Bram Enning

unread,
Jul 20, 2010, 3:34:47 AM7/20/10
to puppet-users
Hi Steve,

I started all over again, below are the steps I took:

On a Mac I created a VirtualBox-instance with Ubuntu Lucid and just a basic install;

sudo aptitude install puppet puppetmaster puppet-common ssh git-core pwgen;

git clone http://github.com/camptocamp/puppet-mysql.git;
git clone http://github.com/camptocamp/puppet-common.git;
git clone http://github.com/camptocamp/puppet-augeas.git;

mv ./puppet-mysql /etc/puppet/modules/mysql;
mv ./puppet-common /etc/puppet/modules/common;
mv ./puppet-augeas /etc/puppet/modules/augeas;

created "modules.pp" containing:
   import "common"

and "site.pp" containing:
<code>
   import "modules.pp"  
   Exec { path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }

   node 'mysql' {
       include augeas

       include mysql::server
       mysql::rights{"Set rights for puppet database":
         ensure   => present,
         database => "puppet",
         user     => "puppet",
         password => "puppet"
        }
     mysql::database{"mydb":
          ensure   => present
        }
}
</code>

In "/etc/hosts" I added:
   192.168.1.29     mysql

Then I issued:
   /etc/init.d/puppetmaster stop
   /etc/init.d/puppet stop
   puppetmasterd --mkusers
   puppetd --waitforcert 60 --verbose -- server mysql
   puppetd --test --debug --server mysql

And once again MySQL gets installed BUT NOT THE DB's AND GRANTS GRRRRRRR^&&*%$^%$#^
mysql-client gets installed.

I checked the existince of the augeas and mysql libs in /var/lib/puppet/lib. They are there but are not executable, but I don't think that's necessary.

This is my debug-info:


===============================
root@mysql:/var/lib/puppet/lib/puppet/parser/functions# puppetd --test --server mysql --debug

debug: Failed to load library 'selinux' for feature 'selinux'
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist

debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/mysql.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/public_keys/mysql.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/run/puppet/puppetd.pid]: Autorequiring File[/var/run/puppet]

debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/mysql.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: Finishing transaction -610902358 with 0 changes
debug: Using cached certificate for ca, good until Fri Jul 17 20:12:29 UTC 2015
debug: Using cached certificate for mysql, good until Fri Jul 17 20:12:29 UTC 2015
debug: Loaded state in 0.00 seconds
info: Retrieving plugin
debug: Using cached certificate for ca, good until Fri Jul 17 20:12:29 UTC 2015
debug: Using cached certificate for mysql, good until Fri Jul 17 20:12:29 UTC 2015

debug: Using cached certificate_revocation_list for ca, good until
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson
debug: Finishing transaction -611098378 with 0 changes

debug: Executing '/etc/puppet/etckeeper-commit-pre'
info: Loading facts in mysql
info: Loading facts in mysql

sh: Syntax error: Bad fd number
debug: catalog supports formats: b64_zlib_yaml marshal pson raw yaml; using pson
info: Caching catalog for mysql

debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist

debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_info does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does not exist

debug: Puppet::Type::Package::ProviderAptrpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderUrpmi: file rpm does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portversion does not exist

debug: Puppet::Type::Package::ProviderYum: file rpm does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_info does not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/bin/pkginfo does not exist

debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does not exist

debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist
debug: Creating default schedules
debug: Finishing transaction -611345898 with 0 changes
debug: Loaded state in 0.00 seconds

debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-query -W --showformat '${Status} ${Package} ${Version}\n''

debug: //mysql::server/User[mysql]/require: requires Package[mysql-server]
debug: //mysql::server/Augeas[my.cnf/client]/require: requires File[/etc/mysql/my.cnf]
debug: //mysql::server/File[/var/lib/mysql]/require: requires Package[mysql-server]
debug: //mysql::server/Service[mysql]/require: requires Package[mysql-server]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/require: requires File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/notify: subscribes to Service[mysql]
debug: //mysql::server/Augeas[my.cnf/replication]/require: requires File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/replication]/notify: subscribes to Service[mysql]
debug: //mysql::server/Augeas[my.cnf/mysqld]/require: requires File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld]/notify: subscribes to Service[mysql]
debug: //mysql::server/Augeas[my.cnf/performance]/require: requires File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/performance]/notify: subscribes to Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]/require: requires Package[mysql-server]
debug: //mysql::server/Exec[Initialize MySQL server root password]/require: requires Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]/notify: subscribes to Exec[Generate my.cnf]
debug: //augeas::debian/Package[augeas-lenses]/before: requires File[/usr/share/augeas/lenses/contrib]

debug: //mysql::server/File[/etc/mysql/my.cnf]/require: requires Package[mysql-server]
debug: //mysql::server/File[/root/.my.cnf]/require: requires Exec[Initialize MySQL server root password]
debug: //augeas::debian/Package[libaugeas0]/before: requires File[/usr/share/augeas/lenses/contrib]
debug: //augeas::debian/Package[augeas-tools]/before: requires File[/usr/share/augeas/lenses/contrib]
debug: //mysql::server/File[/var/lib/mysql]: Autorequiring User[mysql]
debug: //mysql::server/File[/usr/share/augeas/lenses/contrib/mysql.aug]: Autorequiring File[/usr/share/augeas/lenses/contrib]
debug: //mysql::server/Exec[Initialize MySQL server root password]: Skipping automatic relationship with File[/root/.my.cnf]
info: Applying configuration version '1279570845'

debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson
debug: //mysql::server/File[/etc/mysql/my.cnf]/seltype: SELinux bindings not found. Ignoring parameter.
debug: Augeas[my.cnf/performance](provider=augeas): Opening augeas with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/performance](provider=augeas): Augeas version 0.7.0 is installed
debug: Augeas[my.cnf/performance](provider=augeas): Will attempt to save and only run if files changed

debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/max_allowed_packet"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/table_cache"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/read_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/read_rnd_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/net_buffer_length"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/myisam_sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/thread_cache_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/query_cache_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/thread_concurrency"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/thread_stack"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqldump/max_allowed_packet"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/isamchk/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/isamchk/sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/isamchk/read_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/isamchk/write_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/key_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/sort_buffer_size"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/read_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/myisamchk/write_buffer"]
debug: Augeas[my.cnf/performance](provider=augeas): Skipping becuase no files were changed
debug: Augeas[my.cnf/performance](provider=augeas): Closed the augeas connection
debug: Augeas[my.cnf/replication](provider=augeas): Opening augeas with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/replication](provider=augeas): Augeas version 0.7.0 is installed
debug: Augeas[my.cnf/replication](provider=augeas): Will attempt to save and only run if files changed

debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/log-bin"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/server-id"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-host"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-user"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-password"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command 'rm' with params ["/files//etc/mysql/my.cnf/mysqld/report-host"]
debug: Augeas[my.cnf/replication](provider=augeas): Skipping becuase no files were changed
debug: Augeas[my.cnf/replication](provider=augeas): Closed the augeas connection
debug: Augeas[my.cnf/mysqld](provider=augeas): Opening augeas with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/mysqld](provider=augeas): Augeas version 0.7.0 is installed
debug: Augeas[my.cnf/mysqld](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/pid-file", "/var/run/mysqld/mysqld.pid"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/old_passwords", "0"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/character-set-server", "utf8"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/log-warnings", "1"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/log-error", "/var/log/mysql.err"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/set", "log-slow-queries"]
debug: Augeas[my.cnf/mysqld](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld/socket", "/var/run/mysqld/mysqld.sock"]

debug: Augeas[my.cnf/mysqld](provider=augeas): Skipping becuase no files were changed
debug: Augeas[my.cnf/mysqld](provider=augeas): Closed the augeas connection
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Opening augeas with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Augeas version 0.7.0 is installed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/pid-file", "/var/run/mysqld/mysqld.pid"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/socket", "/var/run/mysqld/mysqld.sock"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Skipping becuase no files were changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Closed the augeas connection

debug: Service[mysql](provider=debian): Executing 'ps -ef'
debug: Service[mysql](provider=debian): PID is 5443
debug: //mysql::server/Exec[Initialize MySQL server root password]: Executing check 'test -f /root/.my.cnf'

debug: Executing 'test -f /root/.my.cnf'
debug: Augeas[my.cnf/client](provider=augeas): Opening augeas with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/client](provider=augeas): Augeas version 0.7.0 is installed
debug: Augeas[my.cnf/client](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[my.cnf/client](provider=augeas): sending command 'set' with params ["/files//etc/mysql/my.cnf/client/socket", "/var/run/mysqld/mysqld.sock"]

debug: Augeas[my.cnf/client](provider=augeas): Skipping becuase no files were changed
debug: Augeas[my.cnf/client](provider=augeas): Closed the augeas connection
debug: //mysql::server/File[/var/lib/mysql]/seltype: SELinux bindings not found. Ignoring parameter.
debug: Finishing transaction -611367698 with 0 changes
debug: Storing state
debug: Stored state in 0.02 seconds
notice: Finished catalog run in 3.65 seconds
debug: Executing '/etc/puppet/etckeeper-commit-post'

steve .

unread,
Jul 20, 2010, 5:10:27 PM7/20/10
to puppet...@googlegroups.com
Hmmm:

> info: Loading facts in mysql
> sh: Syntax error: Bad fd number
> debug: catalog supports formats: b64_zlib_yaml marshal pson raw yaml; using
> pson

Any insight as to what could be causing that syntax error? Perhaps
Puppet's/Facter's attempts at shelling out to run the MySQL
command-line client is failing for some reason. Could it be getting
installed somewhere the provider's not expecting? What do you get
when you `which mysql` on the mysql node?

bowlby

unread,
Jul 22, 2010, 3:11:36 AM7/22/10
to Puppet Users
Now we're getting somewhere!

I replaced /bin/sh for /bin/bash (mv /bin/sh /bin/sh_old; ln -s /bin/
bash /bin/sh). Probably an oddity of Lucid in /bin/sh?

'which mysql' gave me /usr/bin/mysql but then I checked for mysql-
client, it wasn't installed so I did.

Below is my debug info. As shown in the snippet it seems that puppet
doesn't use/find the /root/.my.cnf file. The file is there and
passwords do work.

(I think I can smell victory, though)

snippet:
debug: Prefetching mysql resources for mysql_user
debug: Puppet::Type::Mysql_user::ProviderMysql: Executing '/usr/bin/
mysql mysql -NBe 'select concat(user, "@", host), password from user''
err: Could not prefetch mysql_user provider 'mysql': #<IO:0xb72caa58>
debug: Prefetching mysql resources for mysql_database
debug: Puppet::Type::Mysql_database::ProviderMysql: Executing '/usr/
bin/mysql mysql -NBe 'show databases''
err: Could not prefetch mysql_database provider 'mysql': #<IO:
0xb72c8d98>

debug:
root@mysql:~# puppetd --test --server mysql --debug
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/
dscl does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting
false
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does
not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/public_keys/mysql.pem]: Autorequiring
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/run/puppet/puppetd.pid]: Autorequiring File[/var/run/
puppet]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/
var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/
lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/mysql.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/
lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/private_keys/mysql.pem]:
Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/
lib/puppet/state]
debug: Finishing transaction -610646308 with 0 changes
debug: Using cached certificate for ca, good until Sun Jul 19 12:24:34
UTC 2015
debug: Using cached certificate for mysql, good until Sun Jul 19
12:24:35 UTC 2015
debug: Loaded state in 0.00 seconds
info: Retrieving plugin
debug: Using cached certificate for ca, good until Sun Jul 19 12:24:34
UTC 2015
debug: Using cached certificate for mysql, good until Sun Jul 19
12:24:35 UTC 2015
debug: Using cached certificate_revocation_list for ca, good until
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: Finishing transaction -610841488 with 0 changes
debug: Executing '/etc/puppet/etckeeper-commit-pre'
info: Loading facts in mysql
info: Loading facts in mysql
debug: catalog supports formats: b64_zlib_yaml marshal pson raw yaml;
using pson
info: Caching catalog for mysql
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not
exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update
does not exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/
svstat does not exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl
does not exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig
does not exist
debug: Puppet::Type::Package::ProviderAptrpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/
portupgrade does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does
not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix-
update does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-
nox does not exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_info
does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall
does not exist
debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderYum: file yum does not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not
exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not
exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmq does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_info does not
exist
debug: Puppet::Type::Package::ProviderSun: file /usr/bin/pkginfo does
not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Creating default schedules
debug: Finishing transaction -610840538 with 0 changes
debug: Loaded state in 0.00 seconds
debug: Prefetching mysql resources for mysql_user
debug: Puppet::Type::Mysql_user::ProviderMysql: Executing '/usr/bin/
mysql mysql -NBe 'select concat(user, "@", host), password from user''
err: Could not prefetch mysql_user provider 'mysql': #<IO:0xb72caa58>
debug: Prefetching mysql resources for mysql_database
debug: Puppet::Type::Mysql_database::ProviderMysql: Executing '/usr/
bin/mysql mysql -NBe 'show databases''
err: Could not prefetch mysql_database provider 'mysql': #<IO:
0xb72c8d98>
debug: Prefetching apt resources for package
debug: Executing '/usr/bin/dpkg-query -W --showformat '${Status} $
{Package} ${Version}\n''
debug: Puppet::Type::Package::ProviderApt: Executing '/usr/bin/dpkg-
query -W --showformat '${Status} ${Package} ${Version}\n''
debug: //mysql::server/Service[mysql]/require: requires Package[mysql-
server]
debug: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_grant[puppet@localhost/puppet]/require: requires File[/
root/.my.cnf]
debug: //mysql::server/User[mysql]/require: requires Package[mysql-
server]
debug: //mysql::server/Augeas[my.cnf/client]/require: requires File[/
etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld]/require: requires File[/
etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld]/notify: subscribes to
Service[mysql]
debug: //mysql::server/File[/root/.my.cnf]/require: requires
Exec[Initialize MySQL server root password]
debug: //mysql::server/Augeas[my.cnf/performance]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/performance]/notify: subscribes
to Service[mysql]
debug: //mysql::server/File[/etc/mysql/my.cnf]/require: requires
Package[mysql-server]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/mysqld_safe]/notify: subscribes
to Service[mysql]
debug: //augeas::debian/Package[libaugeas0]/before: requires File[/usr/
share/augeas/lenses/contrib]
debug: //mysql::server/Augeas[my.cnf/replication]/require: requires
File[/etc/mysql/my.cnf]
debug: //mysql::server/Augeas[my.cnf/replication]/notify: subscribes
to Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
require: requires Package[mysql-server]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
require: requires Service[mysql]
debug: //mysql::server/Exec[Initialize MySQL server root password]/
notify: subscribes to Exec[Generate my.cnf]
debug: //mysql::server/File[/var/lib/mysql]/require: requires
Package[mysql-server]
debug: //augeas::debian/Package[augeas-lenses]/before: requires File[/
usr/share/augeas/lenses/contrib]
debug: //Node[mysql]/Mysql::Database[mydb]/Mysql_database[mydb]/
require: requires File[/root/.my.cnf]
debug: //augeas::debian/Package[augeas-tools]/before: requires File[/
usr/share/augeas/lenses/contrib]
debug: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_user[puppet@localhost]/require: requires File[/root/.my.cnf]
debug: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_grant[puppet@localhost/puppet]: Autorequiring
Mysql_user[puppet@localhost]
debug: //mysql::server/File[/usr/share/augeas/lenses/contrib/
mysql.aug]: Autorequiring File[/usr/share/augeas/lenses/contrib]
debug: //mysql::server/Exec[Initialize MySQL server root password]:
Skipping automatic relationship with File[/root/.my.cnf]
debug: //mysql::server/File[/var/lib/mysql]: Autorequiring User[mysql]
info: Applying configuration version '1279717702'
debug: //mysql::server/File[/etc/mysql/my.cnf]/seltype: SELinux
bindings not found. Ignoring parameter.
debug: Augeas[my.cnf/replication](provider=augeas): Opening augeas
with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/replication](provider=augeas): Augeas version
0.7.0 is installed
debug: Augeas[my.cnf/replication](provider=augeas): Will attempt to
save and only run if files changed
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/log-bin"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/server-id"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-host"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-user"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/master-password"]
debug: Augeas[my.cnf/replication](provider=augeas): sending command
'rm' with params ["/files//etc/mysql/my.cnf/mysqld/report-host"]
debug: Augeas[my.cnf/replication](provider=augeas): Skipping becuase
no files were changed
debug: Augeas[my.cnf/replication](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Opening augeas
with root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Augeas version
0.7.0 is installed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Will attempt to
save and only run if files changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command
'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/pid-file", "/
var/run/mysqld/mysqld.pid"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): sending command
'set' with params ["/files//etc/mysql/my.cnf/mysqld_safe/socket", "/
var/run/mysqld/mysqld.sock"]
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Skipping becuase
no files were changed
debug: Augeas[my.cnf/mysqld_safe](provider=augeas): Closed the augeas
connection
debug: Augeas[my.cnf/client](provider=augeas): Opening augeas with
root /, lens path /usr/share/augeas/lenses/contrib/, flags 0
debug: Augeas[my.cnf/client](provider=augeas): Augeas version 0.7.0 is
installed
debug: Augeas[my.cnf/client](provider=augeas): Will attempt to save
and only run if files changed
debug: Augeas[my.cnf/client](provider=augeas): sending command 'set'
with params ["/files//etc/mysql/my.cnf/client/socket", "/var/run/
mysqld/mysqld.sock"]
debug: Augeas[my.cnf/client](provider=augeas): Skipping becuase no
files were changed
debug: Augeas[my.cnf/client](provider=augeas): Closed the augeas
connection
debug: Service[mysql](provider=debian): Executing 'ps -ef'
debug: Service[mysql](provider=debian): PID is 1351
debug: //mysql::server/Exec[Initialize MySQL server root password]:
Executing check 'test -f /root/.my.cnf'
debug: Executing 'test -f /root/.my.cnf'
debug: Puppet::Type::Mysql_user::ProviderMysql: Executing '/usr/bin/
mysql mysql -NBe select '1' from user where CONCAT(user, '@', host) =
'puppet@localhost''
err: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_user[puppet@localhost]: Failed to retrieve current state of
resource: Execution of '/usr/bin/mysql mysql -NBe select '1' from user
where CONCAT(user, '@', host) = 'puppet@localhost'' returned 1: ERROR
1045 (28000): Access denied for user 'root'@'localhost' (using
password: NO)

notice: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_grant[puppet@localhost/puppet]: Dependency
mysql_user[puppet@localhost] has 1 failures
warning: //Node[mysql]/Mysql::Rights[Set rights for puppet database]/
Mysql_grant[puppet@localhost/puppet]: Skipping because of failed
dependencies
debug: Puppet::Type::Mysql_database::ProviderMysql: Executing '/usr/
bin/mysql mysql -NBe show databases'
err: //Node[mysql]/Mysql::Database[mydb]/Mysql_database[mydb]: Failed
to retrieve current state of resource: Execution of '/usr/bin/mysql
mysql -NBe show databases' returned 1: ERROR 1045 (28000): Access
denied for user 'root'@'localhost' (using password: NO)

debug: //mysql::server/File[/var/lib/mysql]/seltype: SELinux bindings
not found. Ignoring parameter.
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw
yaml; using pson
debug: Finishing transaction -610897678 with 0 changes
debug: Storing state
debug: Stored state in 0.03 seconds
notice: Finished catalog run in 3.62 seconds
debug: Executing '/etc/puppet/etckeeper-commit-post'






On Jul 20, 11:10 pm, "steve ." <leftath...@gmail.com> wrote:
> Hmmm:
>
> > info: Loading facts in mysql
> > sh: Syntax error: Bad fd number
> > debug: catalog supports formats: b64_zlib_yaml marshal pson raw yaml; using
> > pson
>
> Any insight as to what could be causing that syntax error?  Perhaps
> Puppet's/Facter's attempts at shelling out to run the MySQL
> command-line client is failing for some reason.  Could it be getting
> installed somewhere the provider's not expecting?  What do you get
> when you `which mysql` on the mysql node?
>
> On Tue, Jul 20, 2010 at 2:34 AM, Bram Enning <bramenn...@gmail.com> wrote:
> > Hi Steve,
>
> > I started all over again, below are the steps I took:
>
> > On a Mac I created a VirtualBox-instance with Ubuntu Lucid and just a basic
> > install;
>
> > sudo aptitude install puppet puppetmaster puppet-common ssh git-core pwgen;
>
> > git clonehttp://github.com/camptocamp/puppet-mysql.git;
> > git clonehttp://github.com/camptocamp/puppet-common.git;
> > git clonehttp://github.com/camptocamp/puppet-augeas.git;
> ...
>
> read more »

Christopher Johnston

unread,
Jul 27, 2010, 6:41:09 PM7/27/10
to puppet...@googlegroups.com
David,

Curious on how you handle doing a grant of *.* (all attributes) I looked through your puppet type and I see you are individually listing every type out but you are missing event_priv and trigger_priv as grant types. 

-Chris

David Schmitt

unread,
Jul 28, 2010, 2:58:10 AM7/28/10
to puppet...@googlegroups.com
On 7/28/2010 12:41 AM, Christopher Johnston wrote:
> David,
>
> Curious on how you handle doing a grant of *.* (all attributes) I looked
> through your puppet type and I see you are individually listing every
> type out but you are missing event_priv and trigger_priv as grant types.

I haven't worked on those types in a while and it is possible, that
those privs only exist in a later version of mysql?

Christopher Johnston

unread,
Jul 28, 2010, 7:02:34 AM7/28/10
to puppet...@googlegroups.com, puppet...@googlegroups.com
I believe so, have to crack your code open to confirm. But in mysql I see the grants listed.

It would also be useful to have an "all_grants" so each one does not have to be listed out.

Sent from my iPhone

Jakub Veverka

unread,
May 18, 2011, 5:37:10 AM5/18/11
to puppet...@googlegroups.com
I have been solving same issue and it came out that all I had to do was RTFM.

I had to enable pluginsync both on client and puppetmaster...
[main]
pluginsync = true

Joe McDonagh

unread,
May 23, 2011, 3:45:05 PM5/23/11
to puppet...@googlegroups.com
On 07/28/2010 02:58 AM, David Schmitt wrote:
> On 7/28/2010 12:41 AM, Christopher Johnston wrote:
>> David,
>>
>> Curious on how you handle doing a grant of *.* (all attributes) I looked
>> through your puppet type and I see you are individually listing every
>> type out but you are missing event_priv and trigger_priv as grant types.
>
> I haven't worked on those types in a while and it is possible, that
> those privs only exist in a later version of mysql?
>
>
> Best Regards, David
Last time I looked at this there was some stub function in place that
just couldn't be found anywhere. Has there been some recent function on
it? Also, why the augeas module dependency? Grant state is managed in
the db, which is what makes this problem tough to solve for most people.
However, I know Dave's no slouch so maybe I am missing something.

--
Joe McDonagh
IT Infrastructure Consultant

AIM: YoosingYoonickz
IRC: joe-mac on freenode
"When the going gets weird, the weird turn pro."

Reply all
Reply to author
Forward
0 new messages