install-aws-cli: Also install and keep up to date using Puppet.

We previously only did this install on the developer machine and on
initial boot.  Also run it from puppet to make sure we keep the binary
up-to-date.
This commit is contained in:
Alex Vandiver 2024-01-29 15:34:53 -05:00 committed by Tim Abbott
parent e49fc8873b
commit 6902d5db47
4 changed files with 26 additions and 0 deletions

View File

@ -20,6 +20,12 @@ if [ -L "/srv/zulip-aws-tools/v2/current" ] \
exit 0 exit 0
fi fi
# If not running in the initial host bootstrap, and was called with
# arguments, this is just a check.
if [ -z "${RUNNING_IN_CLOUD_INIT+x}" ] && [[ $# -gt 0 ]]; then
exit 1
fi
mkdir -p /srv/zulip-aws-tools mkdir -p /srv/zulip-aws-tools
cd /srv/zulip-aws-tools || exit 1 cd /srv/zulip-aws-tools || exit 1

View File

@ -0,0 +1,17 @@
# @summary Installs the AWS CLI
#
class zulip_ops::aws_tools {
file { '/usr/local/bin/install-aws-cli':
ensure => file,
mode => '0755',
source => 'puppet:///modules/zulip_ops/install-aws-cli',
}
exec { 'install-aws-cli':
require => File['/usr/local/bin/install-aws-cli'],
command => '/usr/local/bin/install-aws-cli',
# When puppet is initially determining which resources need to be
# applied, it will call the unless -- but install-aws-cli may not
# exist yet. Count this as needing to run.
unless => '[ -f /usr/local/bin/install-aws-cli ] && /usr/local/bin/install-aws-cli check',
}
}

View File

@ -120,6 +120,8 @@ class zulip_ops::profile::base {
if $hosting_provider == 'ec2' { if $hosting_provider == 'ec2' {
# This conditional block is for whether it's not # This conditional block is for whether it's not
# chat.zulip.org, which uses a different hosting provider. # chat.zulip.org, which uses a different hosting provider.
include zulip_ops::aws_tools
file { '/root/.ssh/authorized_keys': file { '/root/.ssh/authorized_keys':
ensure => file, ensure => file,
mode => '0600', mode => '0600',

View File

@ -8,6 +8,7 @@
#BRANCH= #BRANCH=
#SSH_SECRET_ID= #SSH_SECRET_ID=
export RUNNING_IN_CLOUD_INIT=1
if ! curl -fLs -m 5 -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 10" >/dev/null; then if ! curl -fLs -m 5 -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 10" >/dev/null; then
echo "This should be run on AWS instances, not locally." echo "This should be run on AWS instances, not locally."
exit 1 exit 1