Barrow Kwan
2007-Jul-19 21:37 UTC
Problem to make service/package has installed and started before "exec" task
I am trying to manage MySQL DB with puppet. So I create a class and would like to set the mysql SQL root password at the beginning. However, the "exec" will run before mysql-server has installed or started which make "exec" failed. how can I make sure the package has installed/run before "exec" task? class mysql-server { package { "mysql": ensure => installed } package { "mysql-server": ensure => installed } service { mysqld: ensure => true, enable => true, require => [ Package["mysql"], Package["mysql-server"] ], subscribe => [ Package["mysql"], Package["mysql-server"] ], before => exec["mysql_set_root_password"] } exec { "Set MySQL server root password": subscribe => [ Package["mysql-server"], Package["mysql"] ], require => [ Package["mysql-server"], Package["mysql"] ], refreshonly => true, unless => "$mysqladmin_bin -uroot -p$mysqladmin_password status", path => "/bin:/usr/bin", command => "$mysqladmin_bin -uroot password $mysqladmin_password", alias => "mysql_set_root_password" } } Barrow Kwan _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Trevor Vaughan
2007-Jul-19 22:07 UTC
Re: Problem to make service/package has installed and started before "exec" task
The same way you did in the service section: require => [ Package["mysql"], Package["mysql-server"] ], Trevor On 7/19/07, Barrow Kwan <bhkwan@thoughtworks.com> wrote:> > I am trying to manage MySQL DB with puppet. So I create a class and would > like to set the mysql SQL root password at the beginning. However, the > "exec" will run before mysql-server has installed or started which make > "exec" failed. how can I make sure the package has installed/run before > "exec" task? > > > > class mysql-server { > > package { "mysql": ensure => installed } > package { "mysql-server": ensure => installed } > > service { mysqld: > ensure => true, > enable => true, > require => [ Package["mysql"], > Package["mysql-server"] ], > subscribe => [ Package["mysql"], > Package["mysql-server"] ], > before => exec["mysql_set_root_password"] > } > > exec { "Set MySQL server root password": > subscribe => [ Package["mysql-server"], Package["mysql"] ], > require => [ Package["mysql-server"], Package["mysql"] ], > refreshonly => true, > unless => "$mysqladmin_bin -uroot -p$mysqladmin_password status", > path => "/bin:/usr/bin", > command => "$mysqladmin_bin -uroot password $mysqladmin_password", > alias => "mysql_set_root_password" > } > > } > > > > Barrow Kwan > > > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users > > >
Barrow Kwan
2007-Jul-19 22:18 UTC
Re: Problem to make service/package has installed and started before "exec" task
I already had that in exec but it didnt'' work... :( On Jul 19, 2007, at 3:07 PM, Trevor Vaughan wrote:> The same way you did in the service section: > > require => [ Package["mysql"], Package["mysql-server"] ], > > Trevor > > > On 7/19/07, Barrow Kwan <bhkwan@thoughtworks.com> wrote: >> >> I am trying to manage MySQL DB with puppet. So I create a class >> and would >> like to set the mysql SQL root password at the beginning. >> However, the >> "exec" will run before mysql-server has installed or started which >> make >> "exec" failed. how can I make sure the package has installed/run >> before >> "exec" task? >> >> >> >> class mysql-server { >> >> package { "mysql": ensure => installed } >> package { "mysql-server": ensure => installed } >> >> service { mysqld: >> ensure => true, >> enable => true, >> require => [ Package["mysql"], >> Package["mysql-server"] ], >> subscribe => [ Package["mysql"], >> Package["mysql-server"] ], >> before => exec["mysql_set_root_password"] >> } >> >> exec { "Set MySQL server root password": >> subscribe => [ Package["mysql-server"], Package["mysql"] ], >> require => [ Package["mysql-server"], Package["mysql"] ], >> refreshonly => true, >> unless => "$mysqladmin_bin -uroot -p$mysqladmin_password status", >> path => "/bin:/usr/bin", >> command => "$mysqladmin_bin -uroot password $mysqladmin_password", >> alias => "mysql_set_root_password" >> } >> >> } >> >> >> >> Barrow Kwan >> >> >> >> >> _______________________________________________ >> Puppet-users mailing list >> Puppet-users@madstop.com >> https://mail.madstop.com/mailman/listinfo/puppet-users >> >> >> > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-usersBarrow Kwan ThoughtWorks Inc 410 Townsend St, 4th Floor San Francisco, CA 94107 USA (415)869-3103 _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users