ansible / terraform-provider-ansible

community terraform provider for ansible
https://registry.terraform.io/providers/ansible/ansible/latest
GNU General Public License v3.0
183 stars 42 forks source link

How to use plugin: aws_ec2 #103

Open pavan-yejare opened 3 months ago

pavan-yejare commented 3 months ago

how to user aws_ec2 plugin in inventroy and name should *aws_ec2.yaml of inventory file name.

we are using aws ssm for connecting to instance

plugin: aws_ec2
regions:
  - us-east-2
hostnames:
  - i-xxxxxxxxxxx
filters:
  instance-state-name: Running

and playbook

---
- hosts: all
  become: true
  vars:
    ansible_connection: aws_ssm
    ansible_aws_ssm_bucket_name: BUCKET_NAME
    ansible_aws_ssm_region: us-east-2
    ssm_timeout: 60
  tasks:
   - name: Update apt repo and cache
     ansible.builtin.shell:
        cmd:  "sudo mkdir data"