One more note on this that I just realized is that the profile only seems 
to fail for the ec2 module.

This works: 

- name: Key Pair | Ensure that the appropriate keypair exists
  ec2_key:
    profile: Socrates
    name: "soc-{{ env_short }}"
    region: "{{ aws_region }}"
    state: present
  register: keypair

This doesn't

- 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)?

On Tuesday, November 24, 2015 at 2:03:51 PM UTC-5, Rob Wilkerson wrote:
>
> I thought this would be the easiest part of creating a dynamic inventory, 
> but I'm having a hell of a time connecting:
>
> boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 
> handlers were checked. ['HmacAuthV4Handler'] Check your credentials
>
> In my <project>/ansible/development/ directory, I have ec2.py and ec2.ini 
> files:
>
> # <project>/ansible/development/ec2.ini
> -- snip --
> boto_profile = Client
>
> # ~/.aws/credentials
> [DifferentClient]
> aws_access_key_id = <DIFFERENT_CLIENT_ACCESS_KEY>
> aws_secret_access_key = <DIFFERENT_CLIENT_SECRET_KEY>
> region = us-east-1
> output = json
>
> [Client]
> aws_access_key_id = <PROJECT_ACCESS_KEY>
> aws_secret_access_key = <PROJECT_ACCESS_KEY>
>
> The keys are for my IAM user with admin privileges and work just fine when 
> specified directly in the ec2 module.
>
> Any idea what I've got misconfigured here? I'm running Ansible 1.9.4.
>
> Thanks.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5f5a4fd5-2631-4e3f-b10d-c57d4255fb98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to