mirror of
https://github.com/certbot/certbot.git
synced 2026-06-04 22:33:00 -04:00
passing in instance data as environment variables
This commit is contained in:
parent
6dab44816d
commit
372578ca92
4 changed files with 19 additions and 15 deletions
|
|
@ -272,7 +272,10 @@ def config_and_launch_boulder(instance):
|
|||
|
||||
def install_and_launch_letsencrypt(instance, boulder_url):
|
||||
execute(local_repo_to_remote)
|
||||
with shell_env(BOULDER_URL=boulder_url):
|
||||
with shell_env(BOULDER_URL=boulder_url,
|
||||
PUBLIC_IP=instance.public_ip_address,
|
||||
PRIVATE_IP=instance.private_ip_address,
|
||||
PUBLIC_HOSTNAME=instance.public_dns_name):
|
||||
execute(deploy_script, cl_args.test_script)
|
||||
|
||||
def grab_letsencrypt_log():
|
||||
|
|
|
|||
|
|
@ -3,22 +3,22 @@
|
|||
#install apache2 on apt systems
|
||||
# debian doesn't come with curl
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --no-upgrade install apache2 curl
|
||||
sudo apt-get -y --no-upgrade install apache2 #curl
|
||||
|
||||
# $BOULDER_URL is dynamically set at execution
|
||||
# $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL are dynamically set at execution
|
||||
# fetch instance data from EC2 metadata service
|
||||
public_host=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-hostname)
|
||||
public_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-ipv4)
|
||||
private_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/local-ipv4)
|
||||
#public_host=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-hostname)
|
||||
#public_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-ipv4)
|
||||
#private_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/local-ipv4)
|
||||
|
||||
# For apache 2.4, set up ServerName
|
||||
sudo sed -i '/ServerName/ s/#ServerName/ServerName/' \
|
||||
/etc/apache2/sites-available/000-default.conf
|
||||
sudo sed -i '/ServerName/ s/www.example.com/'$public_host'/' \
|
||||
sudo sed -i '/ServerName/ s/www.example.com/'$PUBLIC_HOSTNAME'/' \
|
||||
/etc/apache2/sites-available/000-default.conf
|
||||
|
||||
# run letsencrypt-apache2 via letsencrypt-auto
|
||||
cd letsencrypt
|
||||
./letsencrypt-auto -v --debug --text --agree-dev-preview --agree-tos \
|
||||
--renew-by-default --redirect --register-unsafely-without-email \
|
||||
--domain $public_host --server $BOULDER_URL
|
||||
--domain $PUBLIC_HOSTNAME --server $BOULDER_URL
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# $BOULDER_URL is dynamically set at execution
|
||||
# fetch instance data from EC2 metadata service
|
||||
public_host=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-hostname)
|
||||
public_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-ipv4)
|
||||
private_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/local-ipv4)
|
||||
# $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL are dynamically set at execution
|
||||
|
||||
# with curl, instance metadata available from EC2 metadata service:
|
||||
#public_host=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-hostname)
|
||||
#public_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/public-ipv4)
|
||||
#private_ip=$(curl -s http://169.254.169.254/2014-11-05/meta-data/local-ipv4)
|
||||
|
||||
cd letsencrypt
|
||||
./letsencrypt-auto certonly -v --standalone --debug \
|
||||
--text --agree-dev-preview --agree-tos \
|
||||
--renew-by-default --redirect \
|
||||
--register-unsafely-without-email \
|
||||
--domain $public_host --server $BOULDER_URL
|
||||
--domain $PUBLIC_HOSTNAME --server $BOULDER_URL
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# $BOULDER_URL is dynamically set at execution
|
||||
# $PUBLIC_IP $PRIVATE_IP $PUBLIC_HOSTNAME $BOULDER_URL are dynamically set at execution
|
||||
|
||||
cd letsencrypt
|
||||
# help installs virtualenv and does nothing else
|
||||
|
|
|
|||
Loading…
Reference in a new issue