The execution of playbooks is done using the dedicated ansible-playbook command. This command relies on the same Ansible configuration file that we used previously, and therefore, we want to run the command from the root of our Ansible repository. The syntax of the command is as follows:
ansible-playbook <playbook.yml> [options]
We will first run the following command (adapt the value of the private-key option):
$ ansible-playbook helloworld.yml \ --private-key ~/.ssh/EffectiveDevOpsAWS.pem \ -e target=ec2 \ --list-hosts
The option -e (or --extra-vars) allows us to pass extra options for execution. In our case, we are defining the target variable (which we declared in the hosts section of our playbook) to be equal to ...