hey guys I have two manifests that I setup to apply to different types of machines. one is a webservices class that goes like this class webservices { $webapps = [ "php-common","php","httpd" ] package { $webapps: ensure => installed } service { httpd: name => httpd, enable => true, ensure => running, hasstatus => true } } The above works.. when I run puppetd --test on the machine acting as the webserver these apps are installed However for the dbservices manifest which looks like this: class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } class postgres { package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running } } class mysql { $myapps = [ "mysql-server","mysql" ] package { $myapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running } } } Running puppetd --test on the host functioning as the database server these apps are not installed. And I have my nodes setup like this: node ''pclient.acadaca.net'' { include dbservices } node ''mclient.acadaca.net''{ include webservices } Can I get some advice on getting this to work? thanks!! -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hey guys, I''ve made a little progress I''d like to report. I was able to get part of the dbservices manifest to work. But with the manifest written this way postgresql installs and mysql does not. i am not sure why that might be the case: class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } class postgres { package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running } } class mysql { $mysqlapps = [ "mysql-server","mysql","php-mysql" ] package { $mysqlapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running } } } AFAIK it should be ok to include two or more classes in one outer (wrapper) class in your manifest files. When this didn''t work as hoped I then rewrote the manifest as one big class. class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running } $mysqlapps = [ "mysql-server","mysql","php-mysql" ] package { $mysqlapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running } } And when I did that I got this error reporting that the services could not be started: [root@pclient ~]# puppetd --test info: Caching catalog for pclient.acadaca.net info: Applying configuration version ''1298504233'' err: //dbservices/Service[mysqld]/ensure: change from stopped to running failed: Could not start Service[mysqld]: Execution of ''/sbin/service mysqld start'' returned 1: at /etc/puppet/manifests/classes/dbservices.pp:28 err: //dbservices/Service[postgresql]/ensure: change from stopped to running failed: Could not start Service[postgresql]: Execution of ''/sbin/service postgresql start'' returned 1: at /etc/puppet/manifests/classes/dbservices.pp:13 notice: Finished catalog run in 6.76 seconds Now, what has me really curious at this point are these two things I''ve mentioned. Why would it be that I can only have one or the other of the postgres or mysql classes function the way the first manifest is written? Also why if I take everything and put it into one big class the way I did in the second manifest will the services not start? Someone in IRC speculated that the services can''t start because the apps are not present when puppet attempts to start them. I''m having some trouble seeing why that would be the case the way these are written. My nodes are pretty simple in this test environment: node ''pclient.acadaca.net'' { include dbservices } node ''mclient.acadaca.net''{ include webservices } However we hope to roll puppet out to production sometime in the next couple of weeks assuming we can get these issues ironed out. thanks in advance!! On Wed, Feb 23, 2011 at 4:32 PM, Tim Dunphy <bluethundr@gmail.com> wrote:> hey guys > > I have two manifests that I setup to apply to different types of > machines. one is a webservices class that goes like this > > class webservices { > > $webapps = [ "php-common","php","httpd" ] > package { $webapps: ensure => installed } > > service { httpd: > name => httpd, > enable => true, > ensure => running, > hasstatus => true > } > > > > } > > > > The above works.. when I run puppetd --test on the machine acting as > the webserver these apps are installed > > However for the dbservices manifest which looks like this: > > > class dbservices { > > > $pgapps = [ "postgresql84-server","postgresql84" ] > > package { $pgapps: > ensure => installed } > > class postgres { > > package { $pgapps: ensure => installed } > > service { postgresql: > name => postgresql, > enable => true, > ensure => running > } > > } > > > class mysql { > > $myapps = [ "mysql-server","mysql" ] > > package { $myapps: ensure => installed } > > service { mysqld: > name => mysqld, > enable => true, > ensure => running > } > > } > > } > > Running puppetd --test on the host functioning as the database server > these apps are not installed. > > And I have my nodes setup like this: > > node ''pclient.acadaca.net'' { include dbservices } > node ''mclient.acadaca.net''{ include webservices } > > > Can I get some advice on getting this to work? > > thanks!! > > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 23, 11:58 pm, Tim Dunphy <bluethu...@gmail.com> wrote:> Hey guys,<...snip...>> > [root@pclient ~]# puppetd --test > info: Caching catalog for pclient.acadaca.net > info: Applying configuration version ''1298504233'' > err: //dbservices/Service[mysqld]/ensure: change from stopped to > running failed: Could not start Service[mysqld]: Execution of > ''/sbin/service mysqld start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:28 > err: //dbservices/Service[postgresql]/ensure: change from stopped to > running failed: Could not start Service[postgresql]: Execution of > ''/sbin/service postgresql start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:13 > notice: Finished catalog run in 6.76 seconds > > Now, what has me really curious at this point are these two things > I''ve mentioned. Why would it be that I can only have one or the other > of the postgres or mysql classes function the way the first manifest > is written? Also why if I take everything and put it into one big > class the way I did in the second manifest will the services not > start? Someone in IRC speculated that the services can''t start because > the apps are not present when puppet attempts to start them. I''m > having some trouble seeing why that would be the case the way these > are written. >The logs states that "''/sbin/service mysqld start'' returned 1" it looks like the mysqld package has not been installed. AFAIK, and please correct me if I am wrong, puppet will execute your code in a random way. This is why you need to force its logic by doing something like: package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running, require => Package["$pgapps"] } This way you will make sure to have the package installed before running the service. You may need to do some fiddling with the "" as I am not too sure if you need to put them or not but the idea is there anyway... Documentation about this: http://docs.puppetlabs.com/guides/language_guide.html And on the same page, look for: "Chaining resources" HTH Gael -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
So your original case: class dbservices { ... class postgres { ... } class mysql { ... } } Wouldn''t have worked if all you did was: include dbservices Because the ''include'' only executes the contents of the dbservices class right? The ''inner classes'' contents just get declared - but not executed. If you did: include dbservices::mysql include dbservices::postgres The contents should execute. So your second format: class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running } $mysqlapps = [ "mysql-server","mysql","php-mysql" ] package { $mysqlapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running } } I would have added a require => Package["mysql-server"] to the service {mysqld:} bit. And a require => Package["postgresql84-server"] to the service {postgresql: } bit. So: class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running, require => Package["postgresql84-server"], } $mysqlapps = [ "mysql-server","mysql","php-mysql" ] package { $mysqlapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running, require => Package["mysql-server"], } } This would ensure the package gets installed before the service attempts to start. Now ... if your still having problems with the service starting ... what happens when you try to run those service start commands on the command line? Look at the error: err: //dbservices/Service[mysqld]/ensure: change from stopped to running failed: Could not start Service[mysqld]: Execution of ''/sbin/ service mysqld start'' returned 1: at So if you run: /sbin/service mysqld start What does it return? Does it start at all? Check your mysql logs for example. The thing here is that the startup script should return an exit code of 0 for puppet to be happy about its operation ... if it doesn''t this is probably because your startup is having a genuine failure. ken. On Feb 23, 11:58 pm, Tim Dunphy <bluethu...@gmail.com> wrote:> Hey guys, > > I''ve made a little progress I''d like to report. I was able to get > part of the dbservices manifest to work. But with the manifest written > this way postgresql installs and mysql does not. i am not sure why > that might be the case: > > class dbservices { > > $pgapps = [ "postgresql84-server","postgresql84" ] > > package { $pgapps: > ensure => installed } > > class postgres { > > package { $pgapps: ensure => installed } > > service { postgresql: > name => postgresql, > enable => true, > ensure => running > } > > } > > class mysql { > > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > > package { $mysqlapps: ensure => installed } > > service { mysqld: > name => mysqld, > enable => true, > ensure => running > } > > } > > } > > AFAIK it should be ok to include two or more classes in one outer > (wrapper) class in your manifest files. > > When this didn''t work as hoped I then rewrote the manifest as one big class. > > class dbservices { > > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > > service { postgresql: > name => postgresql, > enable => true, > ensure => running > } > > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > package { $mysqlapps: ensure => installed } > > service { mysqld: > name => mysqld, > enable => true, > ensure => running > } > > } > > And when I did that I got this error reporting that the services could > not be started: > > [root@pclient ~]# puppetd --test > info: Caching catalog for pclient.acadaca.net > info: Applying configuration version ''1298504233'' > err: //dbservices/Service[mysqld]/ensure: change from stopped to > running failed: Could not start Service[mysqld]: Execution of > ''/sbin/service mysqld start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:28 > err: //dbservices/Service[postgresql]/ensure: change from stopped to > running failed: Could not start Service[postgresql]: Execution of > ''/sbin/service postgresql start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:13 > notice: Finished catalog run in 6.76 seconds > > Now, what has me really curious at this point are these two things > I''ve mentioned. Why would it be that I can only have one or the other > of the postgres or mysql classes function the way the first manifest > is written? Also why if I take everything and put it into one big > class the way I did in the second manifest will the services not > start? Someone in IRC speculated that the services can''t start because > the apps are not present when puppet attempts to start them. I''m > having some trouble seeing why that would be the case the way these > are written. > > My nodes are pretty simple in this test environment: > > node ''pclient.acadaca.net'' { include dbservices } > node ''mclient.acadaca.net''{ include webservices } > > However we hope to roll puppet out to production sometime in the next > couple of weeks assuming we can get these issues ironed out. > > thanks in advance!! > > > > > > > > > > On Wed, Feb 23, 2011 at 4:32 PM, Tim Dunphy <bluethu...@gmail.com> wrote: > > hey guys > > > I have two manifests that I setup to apply to different types of > > machines. one is a webservices class that goes like this > > > class webservices { > > > $webapps = [ "php-common","php","httpd" ] > > package { $webapps: ensure => installed } > > > service { httpd: > > name => httpd, > > enable => true, > > ensure => running, > > hasstatus => true > > } > > > } > > > The above works.. when I run puppetd --test on the machine acting as > > the webserver these apps are installed > > > However for the dbservices manifest which looks like this: > > > class dbservices { > > > $pgapps = [ "postgresql84-server","postgresql84" ] > > > package { $pgapps: > > ensure => installed } > > > class postgres { > > > package { $pgapps: ensure => installed } > > > service { postgresql: > > name => postgresql, > > enable => true, > > ensure => running > > } > > > } > > > class mysql { > > > $myapps = [ "mysql-server","mysql" ] > > > package { $myapps: ensure => installed } > > > service { mysqld: > > name => mysqld, > > enable => true, > > ensure => running > > } > > > } > > > } > > > Running puppetd --test on the host functioning as the database server > > these apps are not installed. > > > And I have my nodes setup like this: > > > node ''pclient.acadaca.net'' { include dbservices } > > node ''mclient.acadaca.net''{ include webservices } > > > Can I get some advice on getting this to work? > > > thanks!! > > > -- > > GPG me!! > > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > > debug.txt > 15KViewDownload-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi Ken, That''s very illuminating. Thank you! I plan to try this when I get to work. If I run into any more issues I''ll follow up, but I think I should be good! best regards! tim On Thu, Feb 24, 2011 at 5:31 AM, Ken Barber <ken@bob.sh> wrote:> So your original case: > > class dbservices { > ... > > class postgres { > ... > } > > class mysql { > ... > } > } > > Wouldn''t have worked if all you did was: > > include dbservices > > Because the ''include'' only executes the contents of the dbservices > class right? The ''inner classes'' contents just get declared - but not > executed. > > If you did: > > include dbservices::mysql > include dbservices::postgres > > The contents should execute. > > So your second format: > > class dbservices { > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > service { postgresql: > name => postgresql, > enable => true, > ensure => running > } > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > package { $mysqlapps: ensure => installed } > service { mysqld: > name => mysqld, > enable => true, > ensure => running > } > } > > I would have added a require => Package["mysql-server"] to the service > {mysqld:} bit. And a require => Package["postgresql84-server"] to the > service {postgresql: } bit. So: > > class dbservices { > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > service { postgresql: > name => postgresql, > enable => true, > ensure => running, > require => Package["postgresql84-server"], > } > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > package { $mysqlapps: ensure => installed } > service { mysqld: > name => mysqld, > enable => true, > ensure => running, > require => Package["mysql-server"], > } > } > > This would ensure the package gets installed before the service > attempts to start. > > Now ... if your still having problems with the service starting ... > what happens when you try to run those service start commands on the > command line? Look at the error: > > err: //dbservices/Service[mysqld]/ensure: change from stopped to > running failed: Could not start Service[mysqld]: Execution of ''/sbin/ > service mysqld start'' returned 1: at > > So if you run: > > /sbin/service mysqld start > > What does it return? Does it start at all? Check your mysql logs for > example. > > The thing here is that the startup script should return an exit code > of 0 for puppet to be happy about its operation ... if it doesn''t this > is probably because your startup is having a genuine failure. > > ken. > > On Feb 23, 11:58 pm, Tim Dunphy <bluethu...@gmail.com> wrote: >> Hey guys, >> >> I''ve made a little progress I''d like to report. I was able to get >> part of the dbservices manifest to work. But with the manifest written >> this way postgresql installs and mysql does not. i am not sure why >> that might be the case: >> >> class dbservices { >> >> $pgapps = [ "postgresql84-server","postgresql84" ] >> >> package { $pgapps: >> ensure => installed } >> >> class postgres { >> >> package { $pgapps: ensure => installed } >> >> service { postgresql: >> name => postgresql, >> enable => true, >> ensure => running >> } >> >> } >> >> class mysql { >> >> $mysqlapps = [ "mysql-server","mysql","php-mysql" ] >> >> package { $mysqlapps: ensure => installed } >> >> service { mysqld: >> name => mysqld, >> enable => true, >> ensure => running >> } >> >> } >> >> } >> >> AFAIK it should be ok to include two or more classes in one outer >> (wrapper) class in your manifest files. >> >> When this didn''t work as hoped I then rewrote the manifest as one big class. >> >> class dbservices { >> >> $pgapps = [ "postgresql84-server","postgresql84" ] >> package { $pgapps: ensure => installed } >> >> service { postgresql: >> name => postgresql, >> enable => true, >> ensure => running >> } >> >> $mysqlapps = [ "mysql-server","mysql","php-mysql" ] >> package { $mysqlapps: ensure => installed } >> >> service { mysqld: >> name => mysqld, >> enable => true, >> ensure => running >> } >> >> } >> >> And when I did that I got this error reporting that the services could >> not be started: >> >> [root@pclient ~]# puppetd --test >> info: Caching catalog for pclient.acadaca.net >> info: Applying configuration version ''1298504233'' >> err: //dbservices/Service[mysqld]/ensure: change from stopped to >> running failed: Could not start Service[mysqld]: Execution of >> ''/sbin/service mysqld start'' returned 1: at >> /etc/puppet/manifests/classes/dbservices.pp:28 >> err: //dbservices/Service[postgresql]/ensure: change from stopped to >> running failed: Could not start Service[postgresql]: Execution of >> ''/sbin/service postgresql start'' returned 1: at >> /etc/puppet/manifests/classes/dbservices.pp:13 >> notice: Finished catalog run in 6.76 seconds >> >> Now, what has me really curious at this point are these two things >> I''ve mentioned. Why would it be that I can only have one or the other >> of the postgres or mysql classes function the way the first manifest >> is written? Also why if I take everything and put it into one big >> class the way I did in the second manifest will the services not >> start? Someone in IRC speculated that the services can''t start because >> the apps are not present when puppet attempts to start them. I''m >> having some trouble seeing why that would be the case the way these >> are written. >> >> My nodes are pretty simple in this test environment: >> >> node ''pclient.acadaca.net'' { include dbservices } >> node ''mclient.acadaca.net''{ include webservices } >> >> However we hope to roll puppet out to production sometime in the next >> couple of weeks assuming we can get these issues ironed out. >> >> thanks in advance!! >> >> >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 4:32 PM, Tim Dunphy <bluethu...@gmail.com> wrote: >> > hey guys >> >> > I have two manifests that I setup to apply to different types of >> > machines. one is a webservices class that goes like this >> >> > class webservices { >> >> > $webapps = [ "php-common","php","httpd" ] >> > package { $webapps: ensure => installed } >> >> > service { httpd: >> > name => httpd, >> > enable => true, >> > ensure => running, >> > hasstatus => true >> > } >> >> > } >> >> > The above works.. when I run puppetd --test on the machine acting as >> > the webserver these apps are installed >> >> > However for the dbservices manifest which looks like this: >> >> > class dbservices { >> >> > $pgapps = [ "postgresql84-server","postgresql84" ] >> >> > package { $pgapps: >> > ensure => installed } >> >> > class postgres { >> >> > package { $pgapps: ensure => installed } >> >> > service { postgresql: >> > name => postgresql, >> > enable => true, >> > ensure => running >> > } >> >> > } >> >> > class mysql { >> >> > $myapps = [ "mysql-server","mysql" ] >> >> > package { $myapps: ensure => installed } >> >> > service { mysqld: >> > name => mysqld, >> > enable => true, >> > ensure => running >> > } >> >> > } >> >> > } >> >> > Running puppetd --test on the host functioning as the database server >> > these apps are not installed. >> >> > And I have my nodes setup like this: >> >> > node ''pclient.acadaca.net'' { include dbservices } >> > node ''mclient.acadaca.net''{ include webservices } >> >> > Can I get some advice on getting this to work? >> >> > thanks!! >> >> > -- >> > GPG me!! >> >> > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >> >> -- >> GPG me!! >> >> gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >> >> debug.txt >> 15KViewDownload > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi guys, Ok well thanks for your input here! And some progress is being made. First I tried working with the manifest as one big class called "dbservices" class dbservices { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } $mysqlapps = [ "mysql-server","mysql","php-mysql" ] package { $mysqlapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running, require => Package[$pgapps] } service { mysqld: name => mysqld, enable => true, ensure => running, require => Package[$mysqlapps] } } This results in the following run on the db hosts [root@pclient ~]# puppetd --test info: Caching catalog for pclient.acadaca.net info: Applying configuration version ''1298562089'' notice: //dbservices/Package[mysql-server]/ensure: created notice: //dbservices/Package[php-mysql]/ensure: created notice: //dbservices/Service[mysqld]/ensure: ensure changed ''stopped'' to ''running'' notice: //dbservices/Package[postgresql84]/ensure: created notice: //dbservices/Package[postgresql84-server]/ensure: created err: //dbservices/Service[postgresql]/ensure: change from stopped to running failed: Could not start Service[postgresql]: Execution of ''/sbin/service postgresql start'' returned 1: at /etc/puppet/manifests/classes/dbservices.pp:18 notice: Finished catalog run in 48.32 seconds If I do a yum remove of those apps and then write the required lines this way: require => Package["$mysqlapps"] require => Package["$pgapps"] (with quotes around the array variables) It results in this puppet run on the db host: [root@pclient ~]# puppetd --test info: Caching catalog for pclient.acadaca.net err: Could not run Puppet configuration client: Could not find dependency Package[mysql-servermysqlphp-mysql] for Service[mysqld] at /etc/puppet/manifests/classes/dbservices.pp:27 And if I write the dbservices manifest this way: class dbservices { class postgres { $pgapps = [ "postgresql84-server","postgresql84" ] package { $pgapps: ensure => installed } service { postgresql: name => postgresql, enable => true, ensure => running, require => Package[$pgapps] } } class mysql { $mysqlapps = [ "mysql-server","mysql" ] package { $mysqlapps: ensure => installed } service { mysqld: name => mysqld, enable => true, ensure => running, require => Package[$mysqlapps] } } } And the db node written this way: node ''pclient.acadaca.net'' { include dbservices::mysql include dbservices::postgres } both database apps are installed but these errors occur: err: //dbservices::postgres/Service[postgresql]/ensure: change from stopped to running failed: Could not start Service[postgresql]: Execution of ''/sbin/service postgresql start'' returned 1: at /etc/puppet/manifests/classes/dbservices.pp:15 err: //dbservices::mysql/Service[mysqld]/ensure: change from stopped to running failed: Could not start Service[mysqld]: Execution of ''/sbin/service mysqld start'' returned 1: at /etc/puppet/manifests/classes/dbservices.pp:29 Thanks again for your input and I look forward to any advice anyone may have on this matter best!! tim On Thu, Feb 24, 2011 at 3:44 AM, GA_L <gael.reignier@gmail.com> wrote:> > > On Feb 23, 11:58 pm, Tim Dunphy <bluethu...@gmail.com> wrote: >> Hey guys, > <...snip...> >> >> [root@pclient ~]# puppetd --test >> info: Caching catalog for pclient.acadaca.net >> info: Applying configuration version ''1298504233'' >> err: //dbservices/Service[mysqld]/ensure: change from stopped to >> running failed: Could not start Service[mysqld]: Execution of >> ''/sbin/service mysqld start'' returned 1: at >> /etc/puppet/manifests/classes/dbservices.pp:28 >> err: //dbservices/Service[postgresql]/ensure: change from stopped to >> running failed: Could not start Service[postgresql]: Execution of >> ''/sbin/service postgresql start'' returned 1: at >> /etc/puppet/manifests/classes/dbservices.pp:13 >> notice: Finished catalog run in 6.76 seconds >> >> Now, what has me really curious at this point are these two things >> I''ve mentioned. Why would it be that I can only have one or the other >> of the postgres or mysql classes function the way the first manifest >> is written? Also why if I take everything and put it into one big >> class the way I did in the second manifest will the services not >> start? Someone in IRC speculated that the services can''t start because >> the apps are not present when puppet attempts to start them. I''m >> having some trouble seeing why that would be the case the way these >> are written. >> > > The logs states that "''/sbin/service mysqld start'' returned 1" it > looks like the mysqld package has not been installed. > > AFAIK, and please correct me if I am wrong, puppet will execute your > code in a random way. > This is why you need to force its logic by doing something like: > > package { $pgapps: ensure => installed } > service { postgresql: > name => postgresql, > enable => true, > ensure => running, > require => Package["$pgapps"] > } > > This way you will make sure to have the package installed before > running the service. > You may need to do some fiddling with the "" as I am not too sure if > you need to put them or not but the idea is there anyway... > > Documentation about this: http://docs.puppetlabs.com/guides/language_guide.html > And on the same page, look for: "Chaining resources" > > HTH > Gael > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Also I should have mentioned that both services start by hand with an exit code of 0 (echo $?) best regards, tim On Thu, Feb 24, 2011 at 11:17 AM, Tim Dunphy <bluethundr@gmail.com> wrote:> Hi guys, > > Ok well thanks for your input here! And some progress is being made. > > > First I tried working with the manifest as one big class called "dbservices" > > > class dbservices { > > > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > > > > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > package { $mysqlapps: ensure => installed } > > > service { postgresql: > name => postgresql, > enable => true, > ensure => running, > require => Package[$pgapps] > } > > > > service { mysqld: > name => mysqld, > enable => true, > ensure => running, > require => Package[$mysqlapps] > } > > > } > > > This results in the following run on the db hosts > > > [root@pclient ~]# puppetd --test > info: Caching catalog for pclient.acadaca.net > info: Applying configuration version ''1298562089'' > notice: //dbservices/Package[mysql-server]/ensure: created > notice: //dbservices/Package[php-mysql]/ensure: created > notice: //dbservices/Service[mysqld]/ensure: ensure changed ''stopped'' > to ''running'' > notice: //dbservices/Package[postgresql84]/ensure: created > notice: //dbservices/Package[postgresql84-server]/ensure: created > err: //dbservices/Service[postgresql]/ensure: change from stopped to > running failed: Could not start Service[postgresql]: Execution of > ''/sbin/service postgresql start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:18 > notice: Finished catalog run in 48.32 seconds > > > > If I do a yum remove of those apps and then write the required lines this way: > > require => Package["$mysqlapps"] > require => Package["$pgapps"] > > > (with quotes around the array variables) > > It results in this puppet run on the db host: > > [root@pclient ~]# puppetd --test > info: Caching catalog for pclient.acadaca.net > err: Could not run Puppet configuration client: Could not find > dependency Package[mysql-servermysqlphp-mysql] for Service[mysqld] at > /etc/puppet/manifests/classes/dbservices.pp:27 > > > And if I write the dbservices manifest this way: > > class dbservices { > > > > > class postgres { > > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > service { postgresql: > name => postgresql, > enable => true, > ensure => running, > require => Package[$pgapps] > } > > } > > > class mysql { > > $mysqlapps = [ "mysql-server","mysql" ] > package { $mysqlapps: ensure => installed } > service { mysqld: > name => mysqld, > enable => true, > ensure => running, > require => Package[$mysqlapps] > } > > } > > } > > And the db node written this way: > > node ''pclient.acadaca.net'' { > include dbservices::mysql > include dbservices::postgres > } > > > > both database apps are installed but these errors occur: > > err: //dbservices::postgres/Service[postgresql]/ensure: change from > stopped to running failed: Could not start Service[postgresql]: > Execution of ''/sbin/service postgresql start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:15 > > err: //dbservices::mysql/Service[mysqld]/ensure: change from stopped > to running failed: Could not start Service[mysqld]: Execution of > ''/sbin/service mysqld start'' returned 1: at > /etc/puppet/manifests/classes/dbservices.pp:29 > > Thanks again for your input and I look forward to any advice anyone > may have on this matter > > best!! > > tim > > > On Thu, Feb 24, 2011 at 3:44 AM, GA_L <gael.reignier@gmail.com> wrote: >> >> >> On Feb 23, 11:58 pm, Tim Dunphy <bluethu...@gmail.com> wrote: >>> Hey guys, >> <...snip...> >>> >>> [root@pclient ~]# puppetd --test >>> info: Caching catalog for pclient.acadaca.net >>> info: Applying configuration version ''1298504233'' >>> err: //dbservices/Service[mysqld]/ensure: change from stopped to >>> running failed: Could not start Service[mysqld]: Execution of >>> ''/sbin/service mysqld start'' returned 1: at >>> /etc/puppet/manifests/classes/dbservices.pp:28 >>> err: //dbservices/Service[postgresql]/ensure: change from stopped to >>> running failed: Could not start Service[postgresql]: Execution of >>> ''/sbin/service postgresql start'' returned 1: at >>> /etc/puppet/manifests/classes/dbservices.pp:13 >>> notice: Finished catalog run in 6.76 seconds >>> >>> Now, what has me really curious at this point are these two things >>> I''ve mentioned. Why would it be that I can only have one or the other >>> of the postgres or mysql classes function the way the first manifest >>> is written? Also why if I take everything and put it into one big >>> class the way I did in the second manifest will the services not >>> start? Someone in IRC speculated that the services can''t start because >>> the apps are not present when puppet attempts to start them. I''m >>> having some trouble seeing why that would be the case the way these >>> are written. >>> >> >> The logs states that "''/sbin/service mysqld start'' returned 1" it >> looks like the mysqld package has not been installed. >> >> AFAIK, and please correct me if I am wrong, puppet will execute your >> code in a random way. >> This is why you need to force its logic by doing something like: >> >> package { $pgapps: ensure => installed } >> service { postgresql: >> name => postgresql, >> enable => true, >> ensure => running, >> require => Package["$pgapps"] >> } >> >> This way you will make sure to have the package installed before >> running the service. >> You may need to do some fiddling with the "" as I am not too sure if >> you need to put them or not but the idea is there anyway... >> >> Documentation about this: http://docs.puppetlabs.com/guides/language_guide.html >> And on the same page, look for: "Chaining resources" >> >> HTH >> Gael >> >> -- >> You received this message because you are subscribed to the Google Groups "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. >> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >> >> > > > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 24, 10:52 am, Tim Dunphy <bluethu...@gmail.com> wrote:> Also I should have mentioned that both services start by hand with an > exit code of 0 (echo $?)Do the initscripts depend on any environment variables that they do not set themselves? When run by Puppet, the scripts will have a much sparser environment than when run by hand. Is the Puppet agent authorized to start those services? Even running as root, it might be denied access under some circumstances. The might happen, for example, if you are running SELinux in enforcing mode, and the local policy does not permit Puppet to start those services. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 24, 10:17 am, Tim Dunphy <bluethu...@gmail.com> wrote:> class dbservices { > > $pgapps = [ "postgresql84-server","postgresql84" ] > package { $pgapps: ensure => installed } > > $mysqlapps = [ "mysql-server","mysql","php-mysql" ] > package { $mysqlapps: ensure => installed } > > service { postgresql: > name => postgresql, > enable => true, > ensure => running, > require => Package[$pgapps] > } > > service { mysqld: > name => mysqld, > enable => true, > ensure => running, > require => Package[$mysqlapps] > } > > }[...]> If I do a yum remove of those apps and then write the required lines this way: > > require => Package["$mysqlapps"] > require => Package["$pgapps"] > > (with quotes around the array variables) > > It results in this puppet run on the db host: > > [root@pclient ~]# puppetd --test > info: Caching catalog for pclient.acadaca.net > err: Could not run Puppet configuration client: Could not find > dependency Package[mysql-servermysqlphp-mysql] for Service[mysqld] at > /etc/puppet/manifests/classes/dbservices.pp:27That''s normal. Puppet should perhaps issue a better (or earlier) error message for this case, but the bottom line is that Package[ $arrayvar ] references a single package whose name is the concatenation of all the elements of $arrayvar, not, as you had hoped, an array of Package references. It is not easy in Puppet DSL to generate an array of resource references from an array of resource names, but in this case it should not be necessary to do so. The postgresql and mysqld services do not need to depend on all of $pgapps and $mysqlapps, respectively. They only need to depend on the packages that actually provide them, i.e. postgresql84-server and mysql-server. It does no good and is potentially harmful to declare dependencies that don''t actually exist, so you should write: service { "postgresql": name => "postgresql", enable => true, ensure => running, require => Package["postgresql84-server''] } service { "mysqld": name => "mysqld", enable => true, ensure => running, require => Package["mysql-server"] } That should take care of the errors you encountered when the servers are not already installed before the Puppet run. I see no reason to expect that it will affect the errors you encounter when Puppet tries to start those services, however. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 24, 10:52 am, Tim Dunphy <bluethu...@gmail.com> wrote:> Also I should have mentioned that both services start by hand with an > exit code of 0 (echo $?)Do the dbserver scripts depend on something else environmental, such as some other service being up? The network service springs to mind as a possible example, though if the network were down then your node should not be able to obtain its catalog from the Pupeptmaster. If you start the services by hand, then shut them down, then perform a Puppet run, do the service startups still fail? If so, can you thereafter still start them by hand? Is there any chance that the failures arise because the services are already running? An LSB-conformant initscript will exit with an error code (probably 1) if asked to start a service that is already running. If your initscripts support the "status" command, then your service declarations should include hasstatus => true to make Puppet use it. If not, then you may need use the "status" property to tell Puppet how to recognize whether the services are running. Without either, Puppet has to fall back to looking in the process list, which is error-prone. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hello list!! Your help is invaluable and genuinely appreciated!! Here is the manifest as things stand now: class dbservices { class postgres { $pgapps = ["postgresql84-server","postgresql84"] package { $pgapps: ensure => installed } user { "postgres:": uid => 26, ensure => present } group { "postgres": gid => 26, ensure => present } $preqs = [''User["postgres"]'',''Group["postgres"]'',''Package["postgresql84-server"]''] # Initialize the postgres db exec {"initialize-pgsql": environment => ["USER=postgres"], command => "/sbin/service postgresql initdb", creates => "/var/lib/pgsql/data", require => Package["postgresql84-server"], loglevel => debug } service { postgresql: name => postgresql, enable => true, hasstatus => true, ensure => running, require => Package["postgresql84-server"], loglevel => debug } } class mysql { $mysqlapps = ["mysql-server","mysql","php-mysql"] package { $mysqlapps: ensure => installed } user { "mysql": uid => 27, ensure => present } group { "mysql": gid => 27, ensure => present } $mreqs = [''User["mysql"]'',''Group["mysql"]'',''Package["mysql-server"]''] service { mysqld: name => mysqld, enable => true, hasstatus => true, ensure => running, require => $mreqs, loglevel => debug } } } With my nodes setup as such: node ''pclient.acadaca.net'' { include basefiles include baseapps include dbservices::mysql include dbservices::postgres } node ''pclient2.acadaca.net'' { include basefiles include baseapps include dbservices::mysql include dbservices::postgres } node ''pclient3.acadaca.net'' { include basefiles include baseapps include dbservices::mysql include dbservices::postgres } node ''mclient.acadaca.net''{ include basefiles include baseapps include webservices } Which results in the following run on the client: [root@pclient3 ~]# puppetd --test info: Caching catalog for pclient3.acadaca.net err: Could not run Puppet configuration client: Could not find dependency User["mysql"] for Service[mysqld] at /etc/puppet/manifests/classes/dbservices.pp:57 For some reason the mysql user isn''t being created. I really feel as if I am close to a solution to this problem and I really appreciate any further input you may have! Tim On Fri, Feb 25, 2011 at 11:31 AM, jcbollinger <John.Bollinger@stjude.org> wrote:> > > On Feb 24, 10:52 am, Tim Dunphy <bluethu...@gmail.com> wrote: >> Also I should have mentioned that both services start by hand with an >> exit code of 0 (echo $?) > > Do the dbserver scripts depend on something else environmental, such > as some other service being up? The network service springs to mind > as a possible example, though if the network were down then your node > should not be able to obtain its catalog from the Pupeptmaster. > > If you start the services by hand, then shut them down, then perform a > Puppet run, do the service startups still fail? If so, can you > thereafter still start them by hand? > > Is there any chance that the failures arise because the services are > already running? An LSB-conformant initscript will exit with an error > code (probably 1) if asked to start a service that is already > running. If your initscripts support the "status" command, then your > service declarations should include hasstatus => true to make Puppet > use it. If not, then you may need use the "status" property to tell > Puppet how to recognize whether the services are running. Without > either, Puppet has to fall back to looking in the process list, which > is error-prone. > > > John > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Feb 25, 3:34 pm, Tim Dunphy <bluethu...@gmail.com> wrote:> class mysql { > > $mysqlapps = ["mysql-server","mysql","php-mysql"] > package { $mysqlapps: ensure => installed } > user { "mysql": > uid => 27, > ensure => present > } > group { "mysql": > gid => 27, > ensure => present > } > $mreqs = [''User["mysql"]'',''Group["mysql"]'',''Package["mysql-server"]''] > service { mysqld: > name => mysqld, > enable => true, > hasstatus => true, > ensure => running, > require => $mreqs, > loglevel => debug > } > > }[...]> [root@pclient3 ~]# puppetd --test > info: Caching catalog for pclient3.acadaca.net > err: Could not run Puppet configuration client: Could not find > dependency User["mysql"] for Service[mysqld] at > /etc/puppet/manifests/classes/dbservices.pp:57 > > For some reason the mysql user isn''t being created. I really feel as > if I am close to a solution to this problem and I really appreciate > any further input you may have!It looks like Puppet thinks the quotes are part of the name of the user, in which case this may work better than your original: $mreqs = [''User[mysql]'',''Group[mysql]'',''Package[mysql-server]''] Something has gotten lost here, however: why are you sticking those in a variable in the first place? Do you have other resources, not shown in your manifest above, that also depend *directly* on that exact collection of resources? Otherwise, using a variable just complicates your life when you could instead write this: service { "mysqld": enable => true, hasstatus => true, ensure => running, require => [ User["mysql"], Group["mysql"], Package["mysql-server"] ], loglevel => debug } Cheers, John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.