diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-16 20:41:23 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-07-16 20:41:23 +0000 |
commit | e74b8affe2aefcea3294ac4567c76e8a15624b73 (patch) | |
tree | 6e96d8732f65863ef9b1a7310a73a9a457a470e6 /documentation/structures.page | |
parent | 8273f2176114c670a75d8784280dd97e77892788 (diff) | |
download | puppet-e74b8affe2aefcea3294ac4567c76e8a15624b73.tar.gz puppet-e74b8affe2aefcea3294ac4567c76e8a15624b73.tar.xz puppet-e74b8affe2aefcea3294ac4567c76e8a15624b73.zip |
fixing html markup
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1398 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'documentation/structures.page')
-rw-r--r-- | documentation/structures.page | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/documentation/structures.page b/documentation/structures.page index 74cff0c68..9d0c3ff41 100644 --- a/documentation/structures.page +++ b/documentation/structures.page @@ -12,8 +12,8 @@ The basic unit of configuration in Puppet are ``types``. Types model objects on the computer being managed, and each builtin type has attributes that determine the final type configuration: - file { "/etc/passwd": owner => root, mode => 644 } - package { apache: install => true } + file { "/etc/passwd": owner => root, mode => 644 } + package { apache: install => true } Puppet also provides facilities for defining new types as collections of existing types (see Components below), but there is no syntactic difference @@ -78,13 +78,13 @@ Functions defined and Classes created within a scope will not be available outside the scope in which they are created: define testing { - file { "/etc/passwd": owner => root } + file { "/etc/passwd": owner => root } } class osx { # override the existing testing definition define testing { - file { "/etc/other": owner => root } + file { "/etc/other": owner => root } } } @@ -96,10 +96,10 @@ of ``/file_repository/test-httpd.conf`` to ``/etc/httpd/conf/httpd.conf``: class webserver { $filename = "/etc/httpd/conf/httpd.conf" define httpd_service (config_file) { - file { $filename : source => $config_file } + file { $filename : source => $config_file } } httpd_service { "test_httpd" : - config_file => "/file_repository/test-httpd.conf" + config_file => "/file_repository/test-httpd.conf" } } @@ -107,7 +107,7 @@ of ``/file_repository/test-httpd.conf`` to ``/etc/httpd/conf/httpd.conf``: # Components - define <name>(<param1>,<param2>,...) {...} + define <name>(<param1>,<param2>,...) {...} Definition of fuctions allows the composition of lower level types into higher level types. @@ -117,33 +117,33 @@ similarly to variables, by preceding their names with the ``$`` character: define svnserve(source, path, user = false, password = false) { file { $path: - create => directory, - owner => root, - group => root + create => directory, + owner => root, + group => root } $svncmd = $user ? { - false => "/usr/bin/svn co --non-interactive $source/$name .", - default => "/usr/bin/svn co --non-interactive --username $user --password '$password' $source/$name ." + false => "/usr/bin/svn co --non-interactive $source/$name .", + default => "/usr/bin/svn co --non-interactive --username $user --password '$password' $source/$name ." } exec { $svncmd: - cwd => $path, - require => file[$path], - creates => "$path/.svn" + cwd => $path, + require => file[$path], + creates => "$path/.svn" } } svnserve { dist: - source => "https://reductivelabs.com/svn", - path => "/dist", - user => "puppet", - password => "password" + source => "https://reductivelabs.com/svn", + path => "/dist", + user => "puppet", + password => "password" } svnserve { "dist/config/apps/puppet": - source => "https://reductivelabs.com/svn", - path => "/etc/puppet", - user => "puppet", - password => "password" + source => "https://reductivelabs.com/svn", + path => "/etc/puppet", + user => "puppet", + password => "password" } Note that calling components results in a unique instance of all contained @@ -159,7 +159,7 @@ result in an error at run time. # Server Classes - class <class_name> [inherits <super_class_name>] { ... } + class <class_name> [inherits <super_class_name>] { ... } Class definitions allow the specification of a hierarchy of server classes; a host that is a member of a subclass will apply the configuration from the @@ -173,15 +173,15 @@ each of the subclasses. # really simple example class solaris { file { - "/etc/passwd": owner => root, group => root, mode => 644; - "/etc/shadow": owner => root, group => root, mode => 440 + "/etc/passwd": owner => root, group => root, mode => 644; + "/etc/shadow": owner => root, group => root, mode => 440 } } class solworkstation inherits solaris { file { - "/etc/sudoers": owner => root, group => root, mode => 440; - "/bin/sudo": owner => root, group => root, mode => 4111 + "/etc/sudoers": owner => root, group => root, mode => 440; + "/bin/sudo": owner => root, group => root, mode => 4111 } } @@ -191,7 +191,7 @@ Because ``include`` is a function, any normal value can be used, including variables and selectors: include $operatingsystem, $hostname ? { - myhost => classA, default classB + myhost => classA, default classB } ## Subclassing @@ -201,15 +201,15 @@ class is that the subclass can override elements in the parent class: class unix { file { "/etc/sudoers": - owner => root, - group => root, - mode => 440 + owner => root, + group => root, + mode => 440 } } class bsd inherits unix { file { "/etc/sudoers": - group => wheel + group => wheel } } @@ -245,7 +245,7 @@ even though there is no code associated with them. The syntax is just like # Nodes - node <hostname> { ... } + node <hostname> { ... } Node definitions specify the configuration to apply to a specific node. By default they are looked for by ``puppetmasterd`` but not by ``puppet``. See @@ -257,7 +257,7 @@ code inside will only apply to the specified node or nodes: class webserver { ... } class dbserver { ... } - file { "/etc/sudoers": mode => 440 } # apply to everyone + file { "/etc/sudoers": mode => 440 } # apply to everyone node host1, host2 { include webserver @@ -285,11 +285,11 @@ specify a default value: define testing(os) { owner = $os ? { - sunos => adm, - redhat => bin, - default => root + sunos => adm, + redhat => bin, + default => root } - file { "/some/file": owner => $owner } + file { "/some/file": owner => $owner } } |