-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a custom HTTP header with Puppet
- Loading branch information
1 parent
af280d2
commit 800b562
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
0x0F-load_balancer/2-puppet_custom_http_response_header.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# creating a custome header with puppet | ||
|
||
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['install nginx'], | ||
} | ||
|
||
exec { 'add_header': | ||
provider => shell, | ||
environment => ["HOST=${hostname}"], | ||
command => 'sudo sed -i "s/include \/etc\/nginx\/sites-enabled\/*;/include \/etc\/nginx\/sites-enabled\/\*;\n\tadd_header X-Served-By \"$HOST\";/" /etc/nginx/nginx.conf', | ||
before => Exec['restart Nginx'], | ||
} | ||
|
||
exec { 'restart Nginx': | ||
provider => shell, | ||
command => 'sudo service nginx restart', | ||
} |