Launching an EC2 Instance with an IAM Role Using Ansible
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