- name: Instances | Create new instances
ec2:
profile: Socrates
region: "{{ aws_region }}"
instance_type: "{{ ec2.instance_type }}"
image: "{{ ec2.ami_id }}"
key_name: "soc-{{ env_short }}"
group: "{{ env_short }}-{{ server_type }}"
exact_count: "{{ ec2.instance_count }}"
count_tag:
Env: "{{ env }}"
ManagedBy: Ansible
ServerType: "{{ server_type }}"
wait: yes
assign_public_ip: no # TODO: change to 'yes' to assign public ip
instance_tags:
Env: "{{ env }}"
ManagedBy: "Ansible"
ServerType: "{{ server_type }}"
Projects: "{{ install_projects | join(',') }}"
# termination_protection: yes
volumes:
- device_name: /dev/sda1
snapshot: snap-2337bd2a
# volume_type: gp2
device_type: gp2
volume_size: 100
delete_on_termination: false
register: ec2
The profile also works for ensuring a security group is present. Any chance it's a bug specific to the ec2 module? Maybe my options for the module (although these options do work if I remove the profile and include the aws_access_key and aws_secret_key directly)?