Skip to content

Commit 44b627f

Browse files
authored
Merge pull request #221 from Sage-Bionetworks/SC-226/add-ssm-user
Add the ssm-user so that it can be added to the docker group
2 parents a61ae60 + aaff19f commit 44b627f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ec2/sc-ec2-linux-jumpcloud-workflows.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ Resources:
219219
SetTags:
220220
- TagRootVolume
221221
- TagInstance
222-
SetupDocker:
223-
- add_docker_user
224222
cfn_hup_service:
225223
files:
226224
/etc/cfn/cfn-hup.conf:
@@ -238,7 +236,7 @@ Resources:
238236
[cfn-auto-reloader-hook]
239237
triggers=post.update
240238
path=Resources.LinuxInstance.Metadata.AWS::CloudFormation::Init
241-
action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LinuxInstance --configsets SetupCfn,SetEnv,SetTags,SetupDocker --region ${AWS::Region}
239+
action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LinuxInstance --configsets SetupCfn,SetEnv,SetTags --region ${AWS::Region}
242240
mode: "000400"
243241
owner: root
244242
group: root
@@ -294,10 +292,6 @@ Resources:
294292
commands:
295293
01_name_tag:
296294
command: "/bin/bash /opt/sage/bin/apply_name_tag.sh"
297-
add_docker_user:
298-
commands:
299-
01_add_jc_user_to_docker_group:
300-
command: "gpasswd -a ssm-user docker"
301295
Properties:
302296
ImageId: "ami-0aa07b115676a7bb0" # https://github.com/Sage-Bionetworks-IT/packer-workflows/releases/tag/v1.0.5
303297
InstanceType: !Ref 'EC2InstanceType'
@@ -317,7 +311,12 @@ Resources:
317311
UserData:
318312
Fn::Base64: !Sub |
319313
#!/bin/bash
320-
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LinuxInstance --configsets SetupCfn,SetEnv,SetTags,SetupDocker --region ${AWS::Region}
314+
# This temporary fix adds the ssm-user here -- adding in init config
315+
# isn't working.
316+
/usr/sbin/useradd -m ssm-user -G docker
317+
/bin/echo "ssm-user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/ssm-user
318+
/bin/chmod 0440 /etc/sudoers.d/ssm-user
319+
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LinuxInstance --configsets SetupCfn,SetEnv,SetTags --region ${AWS::Region}
321320
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource LinuxInstance --region ${AWS::Region}
322321
Tags:
323322
- Key: Name

0 commit comments

Comments
 (0)