So I finished the module based on the style guide and have a working
parameterized mysql-client/server module.
Thanks everyone for the input that helped me get there.
# = Class: mysql
#
# This class installs/configures/manages mysql
#
# == Parameters:
#
# mysql_role => mysqlServer
# mysql_role => mysqlClient
#
# == Requires:
#
# Nothing.
#
# == Sample Usage:
#
# class {'mysql':
# mysql_role => mysqlServer,
# }
#
# Main class that will call either mysql::mysqlClient or
mysql::mysqlClient, mysql::mysqlServer depending on whether the node is
defined as a client or server via $mysql_role
class mysql ( $mysql_role ) {
case $mysql_role {
'mysqlClient': { include mysql::mysqlClient }
'mysqlServer': { include mysql::mysqlClient, mysql::mysqlServer }
default: { include mysql::mysqlClient }
}
}
# End of main class
# Role-based class 'mysqlClient' applies no matter what. This installs
mysql, and ensures a basic my.cnf file.
class mysql::mysqlClient {
package { 'mysql':
ensure => present,
before => [
File['/etc/my.cnf'],
],
}
file { "/etc/my.cnf":
ensure => present,
mode => 644,
owner => root,
group => root,
replace => true,
source => [
"puppet:///nodes/$fqdn/my.cnf",
"puppet:///modules/mysql/my.cnf"
],
}
}
# End of mysqlClient
# Role-based class 'mysqlServer' conditionally applies to provide MySQL
server role items.
class mysql::mysqlServer {
package { 'mysql-server':
ensure => present,
before => [
File['/etc/my.cnf'],
],
}
service { 'mysqld':
ensure => running,
enable => true,
hasrestart => true,
hasstatus => true,
subscribe => File['/etc/my.cnf'],
}
}
On Thursday, January 31, 2013 12:16:11 PM UTC-5, Keith Burdis wrote:
>
> I certainly found it so :-)
> On 31 Jan 2013 17:09, "Kodiak Firesmith" <[email protected] <javascript:>>
> wrote:
>
>> Thanks very much Keith; if it's nearly as thorough as rpmlint I've no
>> doubt it will be illustrative and saddening to run my humble modules
>> through. :)
>>
>> On Thursday, January 31, 2013 11:18:22 AM UTC-5, Keith Burdis wrote:
>>>
>>> If you like the style guide the you'll like puppet-lint -
>>> https://github.com/rodjek/**puppet-lint<https://github.com/rodjek/puppet-lint>
>>>
>>> - Keith
>>>
>>>
>>> On 31 January 2013 16:15, Kodiak Firesmith <[email protected]> wrote:
>>>
>>>> I figured this out via taking another look at the style guide. This is
>>>> resolved.
>>>>
>>>> Changed this to this:
>>>>
>>>> class mysql-server inherits mysql{}
>>>> ...to...
>>>> class mysql::server inherits mysql{}
>>>>
>>>> And in node def:
>>>>
>>>> include mysql::server
>>>>
>>>>
>>>> Worked perfectly. Thanks style guide!
>>>> *http://docs.puppetlabs.com/guides/style_guide.html#class-inheritance*
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Puppet Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to puppet-users...@**googlegroups.com.
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at
>>>> http://groups.google.com/**group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
>>>> .
>>>> For more options, visit
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>>
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.