forked from deanbirnie/AirBnB_clone_v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path101-setup_web_static.pp
executable file
·62 lines (52 loc) · 1.55 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
# Script that configures Nginx server with some folders and files
exec {'update':
provider => shell,
command => 'sudo apt-get -y update',
before => Exec['install Nginx'],
}
exec {'install Nginx':
provider => shell,
command => 'sudo apt-get -y install nginx',
before => Exec['start Nginx'],
}
exec {'start Nginx':
provider => shell,
command => 'sudo service nginx start',
before => Exec['create first directory'],
}
exec {'create first directory':
provider => shell,
command => 'sudo mkdir -p /data/web_static/releases/test/',
before => Exec['create second directory'],
}
exec {'create second directory':
provider => shell,
command => 'sudo mkdir -p /data/web_static/shared/',
before => Exec['content into html'],
}
exec {'content into html':
provider => shell,
command => 'echo "Holberton School" | sudo tee /data/web_static/releases/test/index.html',
before => Exec['symbolic link'],
}
exec {'symbolic link':
provider => shell,
command => 'sudo ln -sf /data/web_static/releases/test/ /data/web_static/current',
before => Exec['put location'],
}
exec {'put location':
provider => shell,
command => 'sudo sed -i \'38i\\tlocation /hbnb_static/ {\n\t\talias /data/web_static/current/;\n\t\tautoindex off;\n\t}\n\' /etc/nginx/sites-available/default',
before => Exec['restart Nginx'],
}
exec {'restart Nginx':
provider => shell,
command => 'sudo service nginx restart',
before => File['/data/']
}
file {'/data/':
ensure => directory,
owner => 'ubuntu',
group => 'ubuntu',
recurse => true,
}