Sha256: b2aaeae9f124e959b2738d70a839f8e80730a81e62c08c9440766de7251dec90

Contents?: true

Size: 1.88 KB

Versions: 12

Compression:

Stored size: 1.88 KB

Contents

die(){
  echo "error: $1" >&2
  exit 1
}

set -e

export HOME=/root
cd "$HOME"

stop rsyslog

echo "configuring hostname from cloudformation and aws metadata service"
configured_hostname="${CFN_INSTANCE_HOSTNAME}"
configured_hostname_short=$(echo "${configured_hostname}" | cut -d'.' -f 1)
private_hostname=$(curl -sL http://169.254.169.254/latest/meta-data/local-hostname)
private_hostname_short=$(echo "${private_hostname}" | cut -d'.' -f 1)
private_ipv4=$(curl -fsL http://169.254.169.254/latest/meta-data/local-ipv4)
public_hostname=$(curl -fsL http://169.254.169.254/latest/meta-data/public-hostname || :)
public_hostname_short=$(echo "${public_hostname}" | cut -d'.' -f 1)
public_ipv4=$(curl -fsL http://169.254.169.254/latest/meta-data/public-ipv4 || :)

echo "${configured_hostname_short}" > /etc/hostname
hostname -b -F /etc/hostname
sed -i '/127\.0\./d' /etc/hosts
cat >>/etc/hosts <<EOF
127.0.0.1 localhost
${private_ipv4} ${configured_hostname} ${configured_hostname_short}
127.0.1.1 ${private_hostname} ${private_hostname_short}
EOF

if [ -n "${public_hostname}" ]; then
cat >>/etc/hosts <<EOF
127.0.2.1 ${public_hostname} ${public_hostname_short}
EOF
fi

rm -f /etc/rsyslog.d/21-cloudinit.conf

cat >/etc/rsyslog.d/91-receive-container-logs.conf <<EOF
module(load="imfile")
module(load="imtcp" MaxSessions="500")
module(load="imudp")

input(type="imtcp" port="514")
input(type="imudp" port="514")
EOF

if [ -n "$PAPERTRAIL_HOST" ]; then
curl -sL "https://papertrailapp.com/tools/papertrail-bundle.pem" > /etc/ssl/certs/papertrail.pem
cat >/etc/rsyslog.d/99-papertrail.conf <<EOF
\$PreserveFQDN on
\$DefaultNetstreamDriverCAFile /etc/ssl/certs/papertrail.pem
\$ActionSendStreamDriver gtls
\$ActionSendStreamDriverMode 1
\$ActionSendStreamDriverAuthMode x509/name
\$ActionSendStreamDriverPermittedPeer *.papertrailapp.com
*.*          @@${PAPERTRAIL_HOST}
EOF
fi

chown -R root:syslog /var/log/upstart

start rsyslog

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
stacco-0.1.63 ./priv/roles/Common.sh
stacco-0.1.62 ./priv/roles/Common.sh
stacco-0.1.61 ./priv/roles/Common.sh
stacco-0.1.60 ./priv/roles/Common.sh
stacco-0.1.59 ./priv/roles/Common.sh
stacco-0.1.57 ./priv/roles/Common.sh
stacco-0.1.53 ./priv/roles/Common.sh
stacco-0.1.52 ./priv/roles/Common.sh
stacco-0.1.50 ./priv/roles/Common.sh
stacco-0.1.49 ./priv/roles/Common.sh
stacco-0.1.48 ./priv/roles/Common.sh
stacco-0.1.47 ./priv/roles/Common.sh