Steps:
- first install the aws cli
- configure credentials in the default profile
- Use this below code as inventory file
plugin: aws_ec2
regions:
- us-east-1
filters:
# All instances with their state as `running`
instance-state-name: running
keyed_groups:
- key: tags
prefix: tag
hostnames:
- ip-address
now run the below commands
ansible-playbook main.yaml
ansible-playbook configure.yaml