My code works and returns the ssh fingerprint of my code and returns the 
keypair name... however, I do not find my created keypair name in the AWS 
console with newly made aws instance. This means that there's permission 
error on AWS, Ansible code logic error, or lack of understanding the EC2 
configuration.

---
#basic provisioning example
    - name: Create AWS resources
      hosts: localhost
      connection: local
      gather_facts: False
      tasks:
      - name: Create an EC2 instance
        ec2:
          aws_access_key: "{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
          aws_secret_key: "{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
          region: "{{  AWS_REGION  }}"
          instance_type: "t2.small"
          image: "ami-99ci9r99"
          wait: yes
          volumes:
            - device_name: /dev/sda1
              volume_type: gp2
              volume_size: 10
              delete_on_termination: true
          exact_count: 1
          count_tag:
             Name: aws-demo
          instance_tags:
             Name: aws-demo
        register: ec2
      - name: Create a new EC2 key
        ec2_key:
             region: "{{  AWS_REGION  }}"
             name: project
        register: keypair


-- 
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/2948404e-7c73-4449-8665-77bafb77e58a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to