Skip to content

Commit

Permalink
Add a custom HTTP header with Puppet
Browse files Browse the repository at this point in the history
  • Loading branch information
the1Riddle committed Dec 10, 2023
1 parent af280d2 commit 800b562
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 0x0F-load_balancer/2-puppet_custom_http_response_header.pp
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',
}

0 comments on commit 800b562

Please sign in to comment.