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 <[email protected]> wrote:
>
>
> On Feb 23, 11:58 pm, Tim Dunphy <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.