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 <[email protected]> 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 <[email protected]> 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 [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.

Reply via email to