-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathec2-tiny.pp
More file actions
103 lines (87 loc) · 1.93 KB
/
ec2-tiny.pp
File metadata and controls
103 lines (87 loc) · 1.93 KB
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
##
# Puppet script for configuring
# a base Amazon EC2 EL based system
# in preparation for installing eXist
#
# @author Adam Retter <adam.retter@googlemail.com>
#
##
$swap_size = 524288
$exist_data_fs_dev = "/dev/xvdb"
$exist_data = "/exist-data"
exec { "yum update":
command => "/usr/bin/yum update -y"
}
##
# Create Swap file and Switch on the Swap
##
exec { "create swapfile":
command => "/bin/dd if=/dev/zero of=/swapfile1 bs=1024 count=${swap_size}",
creates => "/swapfile1"
}
exec { "mkswap":
command => "/sbin/mkswap /swapfile1",
refreshonly => true,
subscribe => Exec["create swapfile"]
}
exec { "swapon":
command => "/sbin/swapon /swapfile1",
refreshonly => true,
subscribe => Exec["mkswap"],
before => Mount["swap"]
}
mount { "swap":
device => "/swapfile1",
fstype => "swap",
ensure => present,
options => defaults,
dump => 0,
pass => 0,
require => Exec["create swapfile"]
}
##
# Create a storage filesytem for eXist's database
##
exec { "make database fs":
command => "/sbin/mkfs -t ext4 ${exist_data_fs_dev}",
unless => "/bin/mount | /bin/grep ${exist_data_fs_dev} | /bin/grep ext4",
before => Mount[$exist_data]
}
file { $exist_data:
ensure => directory,
mode => 700,
}
mount { $exist_data:
device => $exist_data_fs_dev,
fstype => "ext4",
ensure => mounted,
options => defaults,
dump => 0,
pass => 2,
require => File[$exist_data]
}
##
# Add eXist banner to the MOTD
##
file { "exist motd banner":
path => "/etc/update-motd.d/10-exist-banner",
ensure => present,
mode => 0755,
content =>
'#!/bin/sh
cat << "EOF"
____ ___.__ __
____ \ \/ /|__| _______/ |_
_/ __ \ \ / | | / ___/\ __\
\ ___/ / \ | | \___ \ | |
\___ >/___/\ \|__|/____ > |__|
\/ \_/ \/
NoSQL Native XML Database
and Application Platform
http://www.exist-db.org
EOF'
}
exec { "update motd":
command => "/usr/sbin/update-motd",
require => File["exist motd banner"]
}