forked from mfcrespo/AirBnB_clone_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
101-setup_web_static.pp
executable file
·47 lines (40 loc) · 1.06 KB
/
101-setup_web_static.pp
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
#This pupppet scripts assure an nginx installation
exec {'/usr/bin/env apt-get update':}
->package {'nginx':
ensure => installed,
}
->file { [ '/data/',
'/data/web_static/',
'/data/web_static/releases/',
'/data/web_static/releases/test/',
'/data/web_static/shared/', ]:
ensure => directory,
owner => 'ubuntu',
group => 'ubuntu',
}
->file {'/data/web_static/releases/test/index.html':
ensure => present,
content => "<html>
<head>
</head>
<body>
Holberton School
</body>
</html>",
owner => 'ubuntu',
group => 'ubuntu',
}
-> exec {'/usr/bin/env ln -sf /data/web_static/releases/test/ /data/web_static/current':}
-> exec {'/usr/bin/env chown -R ubuntu:ubuntu /data/':}
->file_line {'add protocol':
ensure => present,
path => '/etc/nginx/sites-available/default',
after => 'listen 80 default_server;',
line => 'location /hbnb_static/ { alias /data/web_static/current/; autoindex off;}',
require => Package['nginx'],
}
->service { 'nginx':
ensure => running,
require => Package['nginx'],
}
->exec {'/usr/bin/env service nginx restart':}