lundi 27 juillet 2015

How to install the packages by passing EC2 user data at the launch time using Ansible

I want to install the nginx by passing it as the user data to the ec2 instance at the launch time. I am passing it like this

  • name: WebServer | Create the WebServer Instance(s)

local_action:

module: ec2
region: "{{ vpc_region }}"
group: "{{ ec2_security_groups[1].sg_name }}"
keypair: "{{ key_name }}"
instance_type: "{{ web_instance_type }}"
****user_data: "sudo apt-get install nginx -y"****
image: "{{ imgae_id.ami }}"
vpc_subnet_id: "{{ public_subnet }}"
assign_public_ip: True
wait: True
wait_timeout: 600

But the above method didn't work for me although it has created the EC2 instance successfully but didn't install the nginx.

Can you please point me in the right direction. Thanks




Aucun commentaire:

Enregistrer un commentaire