---
# Basic provisioning example
- name: Create AWS resources
  hosts: localhost
  connection: local
  gather_facts: False
  vars_files:
    - deploy-ec2.vars

  tasks:
  - name: Create an EC2 instance
    ec2:
      aws_access_key: "{{aws_access_key}}"
      aws_secret_key: "{{aws_secret_key}}"
      key_name: "{{key_name}}"
      region: "{{aws_region}}"
      group_id: "{{security_group}}"
      instance_type: "{{instance_type}}"
      image: "{{ami_id}}"
      wait: yes
      volumes:
      - device_name: /dev/sda1
        volume_type: gp2
        volume_size: 8
        delete_on_termination: true
      exact_count: 2
      count_tag:
        Name: awsdemo
      instance_tags:
        Name: awsdemo
    register: ec2
