Install packages in recently created EC2 instances

52 views
Skip to first unread message

Gustavo Aguiar

unread,
Jan 4, 2016, 11:27:10 PM1/4/16
to ansible...@googlegroups.com
Hi All,

I’m trying to install the httpd package in recently created EC2 instances in my playbook.

I have multiple playbooks in different roles that are being invoked at once.

When I get to add my recently created EC2 instances to the also recently created ELB, my registration fails once my instances doesn’t have httpd running yet and the health_check fails.

What would be the best approach in this case ?

- Installing httpd packages after the EC2 creation and then adding instances to the ELB ?

Thanks in advance,
—Gustavo



This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com

Arbab Nazar

unread,
Jan 5, 2016, 1:24:44 AM1/5/16
to Ansible Project, gustavo...@itmethods.com
You can add the user_data during the ec2 creation like this:

user_data: |
          #!/bin/sh
          sudo yum install -y httpd

For Complete Reference, please check this link

David Karban

unread,
Jan 5, 2016, 5:46:01 AM1/5/16
to ansible...@googlegroups.com
Hi, 

in this case I would first provision web server and join it into ELB after it is fully operational.

David Karban
Linux server specialist/Specialista na správu linuxových serverů
www.karban.eu

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/C958A606-136A-4F16-9A94-80E95A5F6FAB%40itmethods.com.
For more options, visit https://groups.google.com/d/optout.

Gustavo Aguiar

unread,
Jan 5, 2016, 11:47:04 AM1/5/16
to Arbab Nazar, Ansible Project
Thanks, I think thats a good approach.

Quick not for anyone willing to do the same: user_data already runs as root so you must remove sudo from the command.

      user_data: |          
         #!/bin/sh          
         yum install httpd -y  

Thanks Arbab!
Reply all
Reply to author
Forward
0 new messages