File: prism-puppet.html

package info (click to toggle)
node-prismjs 1.30.0%2Bdfsg%2B~1.26.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,220 kB
  • sloc: javascript: 27,628; makefile: 9; sh: 7; awk: 4
file content (139 lines) | stat: -rw-r--r-- 3,259 bytes parent folder | download | duplicates (3)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<h2>Comments</h2>
<pre><code>#
# Foobar
/* Foo
bar */</code></pre>

<h2>Strings and interpolation</h2>
<pre><code>'foo \'bar\' baz'
"$foo \"bar\" ${baz}"

@(FOOBAR) # Unquoted heredoc string
Foo bar baz
FOOBAR

@("BARBAZ"/$L) # Quoted heredoc string
	$foo bar ${baz}
	|-BARBAZ</code></pre>

<h2>Regular expressions</h2>
<pre><code>if $host =~ /^www(\d+)\./ {}
$foo = /foo
	bar # Extended regexes can include comments
baz/x</code></pre>

<h2>Variables</h2>
<pre><code>$foo
$::foobar
$foo::bar::baz</code></pre>

<h2>Functions</h2>
<pre><code>require apache
template('apache/vhost-default.conf.erb')
[1,20,3].filter |$value| { $value &lt; 10 }</code></pre>

<h2>All-in-one example</h2>
<pre><code>file {'ntp.conf':
  path    => '/etc/ntp.conf',
  ensure  => file,
  content => template('ntp/ntp.conf'),
  owner   => 'root',
  mode    => '0644',
}
package {'ntp':
  ensure => installed,
  before => File['ntp.conf'],
}
service {'ntpd':
  ensure    => running,
  subscribe => File['ntp.conf'],
}
Package['ntp'] -> File['ntp.conf'] ~> Service['ntpd']

$package_list = ['ntp', 'apache2', 'vim-nox', 'wget']
$myhash = { key => { subkey => 'b' }}

include ntp
require ntp
class {'ntp':}

define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') {
  include apache
  include apache::params
  $vhost_dir = $apache::params::vhost_dir
  file { "${vhost_dir}/${servername}.conf":
      content => template('apache/vhost-default.conf.erb'),
      owner   => 'www',
      group   => 'www',
      mode    => '644',
      require => Package['httpd'],
      notify  => Service['httpd'],
  }
}

apache::vhost {'homepages':
  port    => 8081,
  docroot => '/var/www-testhost',
}
Apache::Vhost['homepages']

node 'www1.example.com' {
  include common
  include apache
  include squid
}
node /^www\d+$/ {
  include common
}

# comment
/* comment */

if $is_virtual {
  warning( 'Tried to include class ntp on virtual machine; this node may be misclassified.' )
}
elsif $operatingsystem == 'Darwin' {
  warning( 'This NTP module does not yet work on our Mac laptops.' )
else {
  include ntp
}

if $hostname =~ /^www(\d+)\./ {
  notify { "Welcome web server $1": }
}

case $operatingsystem {
  'Solaris':          { include role::solaris }
  'RedHat', 'CentOS': { include role::redhat  }
  /^(Debian|Ubuntu)$/:{ include role::debian  }
  default:            { include role::generic }
}
$rootgroup = $osfamily ? {
    'Solaris'          => 'wheel',
    /(Darwin|FreeBSD)/ => 'wheel',
    default            => 'root',
}

User &lt;| groups == 'admin' |>
Concat::Fragment &lt;&lt;| tag == "bacula-storage-dir-${bacula_director}" |>>

Exec &lt;| title == 'update_migrations' |> {
  environment => 'RUBYLIB=/usr/lib/ruby/site_ruby/1.8/',
}

@user {'deploy':
  uid     => 2004,
  comment => 'Deployment User',
  group   => www-data,
  groups  => ["enterprise"],
  tag     => [deploy, web],
}

@@nagios_service { "check_zfs${hostname}":
  use                 => 'generic-service',
  host_name           => "$fqdn",
  check_command       => 'check_nrpe_1arg!check_zfs',
  service_description => "check_zfs${hostname}",
  target              => '/etc/nagios3/conf.d/nagios_service.cfg',
  notify              => Service[$nagios::params::nagios_service],
}</code></pre>