How to pass variables to Ansible during execution

We can define and assign variables in Ansible playbook by hard-coding it. But if we need to change the value of any variable, the corresponding file need to be edited.

Ansible provides a way to pass variables during execution of playbooks to overcome this situation.

#ansible-playbook PLAYBOOK --extra-vars "VARIABLE=VALUE"

Here PLAYBOOK, VARIABLE and VALUE need to be replaced with the appropriate data.

That's all…