Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom HTTP header with Puppet #10

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
}