From 9634e2a0477fefd7837d5a29dfc7d80a2d6edf4d Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 24 Feb 2021 11:33:52 -0800 Subject: [PATCH] Remove all unnecessary steps in user scripts --- ...rog-artifactory-ec2-instance.template.yaml | 33 +++---------------- .../jfrog-xray-ec2-instance.template.yaml | 26 +-------------- 2 files changed, 5 insertions(+), 54 deletions(-) diff --git a/Amazon/Marketplace/v7153/templates/jfrog-artifactory-ec2-instance.template.yaml b/Amazon/Marketplace/v7153/templates/jfrog-artifactory-ec2-instance.template.yaml index 78983e9..4e37adc 100644 --- a/Amazon/Marketplace/v7153/templates/jfrog-artifactory-ec2-instance.template.yaml +++ b/Amazon/Marketplace/v7153/templates/jfrog-artifactory-ec2-instance.template.yaml @@ -329,17 +329,9 @@ Resources: } - S3URI=${QsS3Uri} - - # Update OS - yum update -y - - # Install git - yum install -y epel-release git policycoreutils-python - - yum update --security -y 2>&1 | tee /var/log/userdata.yum_security_update.log - - yum install -y jq python3 libselinux-python3 + # Install jq + yum install -y epel-release + yum install -y jq echo $PATH @@ -347,24 +339,9 @@ Resources: echo $PATH - # Create virtual env and activate - python3 -m venv ~/venv --system-site-packages + # Activate virtual env source ~/venv/bin/activate - pip install --upgrade pip - pip install jmespath wheel - - # Install Cloudformation helper scripts - pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz 2>&1 | tee /var/log/userdata.aws_cfn_bootstrap_install.log - - pip install awscli 2>&1 | tee /var/log/userdata.awscli_install.log - - pip install ansible 2>&1 | tee /var/log/userdata.ansible_install.log - - mkdir ~/.jfrog_ami - - aws s3 --region ${AWS::Region} sync s3://${QsS3BucketName}/${QsS3KeyPrefix}cloudInstallerScripts/ ~/.jfrog_ami/ || cfn_fail - setsebool httpd_can_network_connect 1 -P # CentOS cloned virtual machines do not create a new machine id @@ -381,8 +358,6 @@ Resources: /root/attach_volume.sh || cfn_fail - ansible-galaxy collection install community.general ansible.posix - setsebool httpd_can_network_connect 1 -P aws secretsmanager get-secret-value --secret-id ${ArtifactoryLicensesSecretName} --region ${AWS::Region} | jq -r '{"artifactory_licenses":(.SecretString | fromjson )}' > ~/.jfrog_ami/licenses.json || cfn_fail diff --git a/Amazon/Marketplace/v7153/templates/jfrog-xray-ec2-instance.template.yaml b/Amazon/Marketplace/v7153/templates/jfrog-xray-ec2-instance.template.yaml index 4190aa0..366f811 100644 --- a/Amazon/Marketplace/v7153/templates/jfrog-xray-ec2-instance.template.yaml +++ b/Amazon/Marketplace/v7153/templates/jfrog-xray-ec2-instance.template.yaml @@ -228,31 +228,9 @@ Resources: echo $PATH - # Create virtual env and activate - python3 -m venv ~/venv --system-site-packages + # Activate virtual env source ~/venv/bin/activate - pip install --upgrade pip - pip install wheel - - S3URI=${QsS3Uri} - - yum update --security -y &> /var/log/userdata.yum_security_update.log - - yum install -y git python3 libselinux-python3 - yum install -y postgresql-server postgresql-devel - - # Install Cloudformation helper scripts - pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz 2>&1 | tee /var/log/userdata.aws_cfn_bootstrap_install.log - - pip install awscli &> /var/log/userdata.awscli_install.log - - pip install ansible &> /var/log/userdata.ansible_install.log - - mkdir ~/.xray_ami - - aws s3 --region ${AWS::Region} sync s3://${QsS3BucketName}/${QsS3KeyPrefix}cloudInstallerScripts/ ~/.xray_ami/ - setsebool httpd_can_network_connect 1 -P # CentOS cloned virtual machines do not create a new machine id @@ -269,8 +247,6 @@ Resources: lsblk # debug - ansible-galaxy collection install community.general ansible.posix - ansible-playbook /root/.xray_ami/xray.yml --vault-id /root/.vault_pass.txt 2>&1 | tee /var/log/xray.log || cfn_fail rm -rf /root/.secureit.sh