write your yml code here and save it as sam-yaml-file.yaml
pip install pyyml
python test-sam-yaml-file.py
copy the content of .pem key (which was used during the lauch of ec2) in a file and save it. Use nano editor.
sudo ssh -i <location & name of the file where .pem key content is saved> ubuntu@
generally this file is in the location /etc/ansible/hosts. If not then create a hosts file anywhere in ubuntu server
nano hosts
[servers] server1 ansible_host= server2 ansible_host= server3 ansible_host=
[all:vars] ansible_python_interpreter=user/bin/python3
ansible-inventory --list -y -i