Skip to content

Commit

Permalink
gruntjscom: Replace robots.txt on stage.gruntjs.com with "Disallow"
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Feb 16, 2024
1 parent f7b8366 commit 137dab8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions hieradata/environments/staging/roles/gruntjscom.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
profile::gruntjscom::canonical_name: stage.gruntjs.com
profile::gruntjscom::aliases: []
profile::gruntjscom::robots_deny: true
8 changes: 8 additions & 0 deletions modules/profile/manifests/gruntjscom.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
String[1] $tls_key_name = lookup('profile::gruntjscom::tls_key_name'),
Stdlib::Fqdn $canonical_name = lookup('profile::gruntjscom::canonical_name'),
Array[Stdlib::Fqdn] $aliases = lookup('profile::gruntjscom::aliases'),
Boolean $robots_deny = lookup('profile::gruntjscom::robots_deny', {default_value => false}),
) {
ensure_packages(['nodejs', 'npm'])

Expand Down Expand Up @@ -50,4 +51,11 @@
content => template('profile/gruntjscom/site.nginx.erb'),
require => Letsencrypt::Certificate[$tls_key_name],
}

if $robots_deny {
file { "${base_path}/robots.txt":
ensure => file,
content => "User-Agent: *\nDisallow: /\n",
}
}
}
6 changes: 6 additions & 0 deletions modules/profile/templates/gruntjscom/site.nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ server {
location /.well-known/acme-challenge {
root /var/www/letsencrypt/;
}

<%- if @robots_deny -%>
location = /robots.txt {
try_files <%= @base_path %>/robots.txt;
}
<%- end -%>
}

server {
Expand Down

0 comments on commit 137dab8

Please sign in to comment.