Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Fitzwater - IDI-C committed Jun 22, 2020
1 parent 9509e36 commit c535bc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .codeinventory.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'GSA/[PROJECT]'
description: '[PROJECT DESCRIPTION]'
name: 'GSA/grace-ansible-lambda'
description: 'Implement a decentralized methodology for execution of Ansible within a particular AWS account on ephemeral EC2 instances instantiated by a Lambda function'
license: cc0-1.0
openSourceProject: 1
governmentWideReuseProject: 1
Expand Down
15 changes: 11 additions & 4 deletions files/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
# set -e

echo "installing Ansible"
# do stuff
sudo amazon-linux-extras install ansible2 -y

echo "installing s3fs"
sudo amazon-linux-extras install epel -y
sudo yum install s3fs-fuse -y

echo "credentials file for s3fs"
echo ${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY} > .passwd-s3fs
chmod 0400 .passwd-s3fs

echo "mounting S3 bucket with Ansible content"
mkdir -p /ansible
s3fs -o iam_role="${role}",bucket="${bucket}" /ansible
mkdir -p ansible
s3fs -o iam_role="${role}",bucket="${bucket}" ansible

echo "starting Ansible execution"
# do stuff
Expand All @@ -18,4 +26,3 @@ echo "requesting cleanup of this EC2 instance"
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`

CRED=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -v "http://169.254.169.254/latest/meta-data/iam/security-credentials/${role}"`

0 comments on commit c535bc4

Please sign in to comment.