Report abuse

1. I have a class:
class templates-services-lamp-class {
...
# set a default password for all MySQL installations, can be overriden per server
  $root_mysql_password = "password"

# if the password is not set (= blanco), set it to $root_mysql_password, otherwise do nothing
  exec {"Set MySQL server root password":
    require => Service ["mysql"],
    onlyif => "mysqladmin -uroot status",
    command => "mysqladmin -uroot password $root_mysql_password",
  }

        file {"/tmp/testfile":
             ensure => present,
             owner  => root,
        }


...
}


2. On another place in my file structure I have:

class classic-shared-database-mysql-class {
# base
  include templates-base-crontab-class
#  include templates-base-disactivate-services-class
  include templates-base-network-class
  include templates-base-scripts-class
#  include templates-base-tools-class

# service
#  include templates-services-bind-class
#  include templates-services-courier-pop3-class
#  include templates-services-dovecot-pop3-class
  include templates-services-lamp-class          <----------------
#  include templates-services-lighttpd-class
#  include templates-services-ntpd-class
#  include templates-services-postfix-class
#  include templates-services-pptp-class
#  include templates-services-proftpd-class
#  include templates-services-syslog-ng-class
}


3. Then I define my node like this:
node testpuppetclient {
  include classic-shared-database-mysql-class
}

Now my node has all the classes to be a 'generic sql server'

Now for my question: I want to override the mysql password on server level. I know a subclass can only override resources defined in a parent class, so this should work:

node testpuppetclient inherits templates-services-lamp-class {
  $root_mysql_password = "other_password"
}

but it DOES NOT. Can you not override a variable then ? 


4. Wat *does* work, is something like:
node testpuppetclient inherits templates-services-lamp-class {
     File["/tmp/testfile"] { owner => someone_else }
}