Launching an EC2 Instance with an IAM Role Using Ansible
I'm trying to launch an instance with an IAM Role using Ansible.
But I don't find how to do it.
Does anyone know if it is possible?
If I can't use Ansible. I try it with boto
http://docs.ansible.com/ec2_module.html
instance_profile_name
(added in 1.3):
Name of the IAM instance profile to use. Boto library must be 2.5.0+
- name: Get Instance ID
debug: var=ec2_id
- name: set IAM ROLE
ec2_instance:
region: eu-west-3
aws_access_key: "{{ package_aws_access_key }}"
aws_secret_key: "{{ package_aws_secret_key }}"
instance_ids:
- "{{ ec2_id }}"
instance_role: "{{ iam_role }}"
delegate_to: localhost