-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2712 from cgolubi1/224_lets_encrypt
Support SSL on AWS-based buttonmen sites
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,23 @@ | ||
##### | ||
# This provides information about the FQDN used for an EC2 site, | ||
# so that consumers like letsencrypt or cloudwatch can access that | ||
# information if it exists. | ||
# | ||
# This module does not change /etc/hosts or /etc/hostname | ||
|
||
class fqdn::base { | ||
file { | ||
# The script that queries EC2 instance tags to get an FQDN | ||
"/usr/local/bin/fqdn_from_ec2_tags": | ||
ensure => file, | ||
content => template("fqdn/from_ec2_tags.erb"), | ||
mode => 555; | ||
} | ||
|
||
# Use fqdn_from_ec2_tags to populate or update a site file | ||
exec { | ||
"fqdn_populate_etc_file": | ||
command => "/usr/local/bin/fqdn_from_ec2_tags /usr/local/etc/bmsite_fqdn", | ||
require => [ File["/usr/local/bin/fqdn_from_ec2_tags"] ]; | ||
} | ||
} |
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,22 @@ | ||
#!/bin/bash | ||
##### fqdn_from_ec2_tags | ||
# Get the FQDN from EC2 instance tags | ||
|
||
# Optionally put the FQDN in a file, otherwise just print it to STDOUT | ||
OUTPUT_FILE=$1 | ||
|
||
FQDN="" | ||
<% if @ec2_services_partition == "aws" -%> | ||
FQDN=$(aws ec2 describe-tags --region <%= ec2_placement_region %> --filters "Name=resource-id,Values=<%= ec2_instance_id %>" "Name=key,Values=fqdn" | grep Value | awk -F\" '{print $4}') | ||
<% end -%> | ||
|
||
# Use a static fake site name for both non-AWS instances and instances that failed the above check | ||
if [ "${FQDN}" = "" ]; then | ||
FQDN="sandbox.buttonweavers.com" | ||
fi | ||
|
||
if [ "${OUTPUT_FILE}" = "" ]; then | ||
echo $FQDN | ||
else | ||
echo "${FQDN}" > ${OUTPUT_FILE} | ||
fi |