-
Notifications
You must be signed in to change notification settings - Fork 0
/
101-setup_web_static.pp
88 lines (72 loc) · 1.76 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
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
# AirBnB clone web server setup and configuration
# STILL WORKING ON THIS SCRIPT---
$nginx_conf = "server {
listen 80 default_server;
listen [::]:80 default_server;
add_header X-Served-By ${hostname};
root /var/www/html;
index index.html index.htm;
location /hbnb_static {
alias /data/web_static/current;
index index.html index.htm;
}
location /redirect_me {
return 301 http://facebook.com/printolab/;
}
error_page 404 /404.html;
location /404 {
root /var/www/html;
internal;
}
}"
package { 'nginx':
ensure => 'present',
provider => 'apt'
}
-> file { '/data':
ensure => 'directory'
}
-> file { '/data/web_static':
ensure => 'directory'
}
-> file { '/data/web_static/releases':
ensure => 'directory'
}
-> file { '/data/web_static/releases/test':
ensure => 'directory'
}
-> file { '/data/web_static/shared':
ensure => 'directory'
}
-> file { '/data/web_static/releases/test/index.html':
ensure => 'present',
content => "this webpage is found in data/web_static/releases/test/index.htm \n"
}
-> file { '/data/web_static/current':
ensure => 'link',
target => '/data/web_static/releases/test'
}
-> exec { 'chown -R ubuntu:ubuntu /data/':
path => '/usr/bin/:/usr/local/bin/:/bin/'
}
file { '/var/www':
ensure => 'directory'
}
-> file { '/var/www/html':
ensure => 'directory'
}
-> file { '/var/www/html/index.html':
ensure => 'present',
content => "This is my first upload in /var/www/index.html***\n"
}
-> file { '/var/www/html/404.html':
ensure => 'present',
content => "Ceci n'est pas une page - Error page\n"
}
-> file { '/etc/nginx/sites-available/default':
ensure => 'present',
content => $nginx_conf
}
-> exec { 'nginx restart':
path => '/etc/init.d/'
}