Run Ansible Playbooks with variables

insert the variables in the playbook using:

hosts: "{{ nodes }}"

then run the playbook with the -e option and show the variables content

ansible-playbook -e nodes=hostname playbook_name.yaml