Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 }
}