Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 688 Bytes

AWS-EC2-creation-ansible-playbook.md

File metadata and controls

29 lines (26 loc) · 688 Bytes
---
 - name: Create an ec2 instance
  hosts: web
  gather_facts: false
  
  vars:
      region: us-east-1
      instance_type: t2.micro
      ami: ami-05ea7729e394412c8
      keypair: priyajdm
  
  tasks:
  
    - name: Create an ec2 instance
      ec2:
         aws_access_key: '********************'
         aws_secret_key: '****************************************'
         key_name: "{{ keypair }}"
         group: launch-wizard-26
         instance_type: "{{ instance_type }}"
         image: "{{ ami }}"
         wait: true
         region: "{{ region }}"
         count: 1
         vpc_subnet_id: subnet-02f498e16fd56c277
         assign_public_ip: yes
    register: ec2