From c535bc46c7783b81e3a837d3fa6cf3a8654e3ec7 Mon Sep 17 00:00:00 2001 From: Brian Fitzwater - IDI-C Date: Mon, 22 Jun 2020 14:43:18 -0400 Subject: [PATCH] WIP --- .codeinventory.yml | 4 ++-- files/run.sh | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.codeinventory.yml b/.codeinventory.yml index e931b56..b3514ac 100644 --- a/.codeinventory.yml +++ b/.codeinventory.yml @@ -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 diff --git a/files/run.sh b/files/run.sh index 751f86d..b08e7d0 100644 --- a/files/run.sh +++ b/files/run.sh @@ -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 @@ -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}"` -