Member-only story
How to Pass Variables to Ansible Playbook in the command line? — Ansible extra variables
How to pass or override an Ansible Playbook variable from the command line in plaintext, JSON, or YAML. Very useful to combine some script, automation, or shell variables. Example with fruit variable defined as “banana” and changed to “apple” or “raspberry”.
4 min readJan 15, 2022
How to pass Pass Variables value to Ansible Playbook in command line?
I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
How to pass Extra Variables to Ansible Playbook?
--extra-vars "fruit=apple"
--extra-vars '{"fruit":"apple"}'
--extra-vars "@file.json"
--extra-vars "@file.yml"
Today we’re talking about Ansible extra variables.
The easiest way to pass Pass Variables value to Ansible Playbook in the command line is using the extra variables…