summaryrefslogtreecommitdiffstats
path: root/documentation/structures.page
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/structures.page')
-rw-r--r--documentation/structures.page78
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&gt;(<param1&gt;,<param2&gt;,...) {...}
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 =&gt; directory,
+ owner =&gt; root,
+ group =&gt; 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 =&gt; "/usr/bin/svn co --non-interactive $source/$name .",
+ default =&gt; "/usr/bin/svn co --non-interactive --username $user --password '$password' $source/$name ."
}
exec { $svncmd:
- cwd => $path,
- require => file[$path],
- creates => "$path/.svn"
+ cwd =&gt; $path,
+ require =&gt; file[$path],
+ creates =&gt; "$path/.svn"
}
}
svnserve { dist:
- source => "https://reductivelabs.com/svn",
- path => "/dist",
- user => "puppet",
- password => "password"
+ source =&gt; "https://reductivelabs.com/svn",
+ path =&gt; "/dist",
+ user =&gt; "puppet",
+ password =&gt; "password"
}
svnserve { "dist/config/apps/puppet":
- source => "https://reductivelabs.com/svn",
- path => "/etc/puppet",
- user => "puppet",
- password => "password"
+ source =&gt; "https://reductivelabs.com/svn",
+ path =&gt; "/etc/puppet",
+ user =&gt; "puppet",
+ password =&gt; "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&gt; [inherits <super_class_name&gt;] { ... }
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 =&gt; root, group =&gt; root, mode =&gt; 644;
+ "/etc/shadow": owner =&gt; root, group =&gt; root, mode =&gt; 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 =&gt; root, group =&gt; root, mode =&gt; 440;
+ "/bin/sudo": owner =&gt; root, group =&gt; root, mode =&gt; 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 =&gt; 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 =&gt; root,
+ group =&gt; root,
+ mode =&gt; 440
}
}
class bsd inherits unix {
file { "/etc/sudoers":
- group => wheel
+ group =&gt; wheel
}
}
@@ -245,7 +245,7 @@ even though there is no code associated with them. The syntax is just like
# Nodes
- node <hostname> { ... }
+ node <hostname&gt; { ... }
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 =&gt; 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 =&gt; adm,
+ redhat =&gt; bin,
+ default =&gt; root
}
- file { "/some/file": owner => $owner }
+ file { "/some/file": owner =&gt; $owner }
}