Ansible: A configuration management tool in Devops

Good day guys hope you all working hard on your Devops methodologies and making progress. Now lets gist about another Devops tool:

Ansible is a configuration management tool in DevOps and is very key, if you have a single task you can use ansible adhoc command and if the taska are multiple task we have to use Ansible-playbook we all know that. Now lets go

DevOps scenerio Question

You were given a task to provision an EC2 instance in Aws using Ansible- playbook, you have written your Ansible-playbook yaml file.

However, you have an Ec2 instance created already where you Installed your Ansible controller and it's running inside this directory below

$ cat etc/ansible/hosts

# To check run the synthax check

$ ansible-playbook ec2.yaml - - synthax - - check

Is all good ✔

However,the moment you run the ansible playbook

$ ansible-playbook i- hosts ec2.yaml

The above throws up the error

" NoCredentialsError: unable to locate credentials"

Now the Question

What do you think technically could have triggered the above error if the yaml file was written well with all the the task it entails.

Remember your response must follow DevOps best practices