Extra Vars on the Command Line
Override values at runtime with -e.
Values at Runtime
Sometimes you want to pick a value when you launch a play, not bake it into a file. That is what extra vars are for. 🌟
The -e Flag
Pass extra vars with the -e (or --extra-vars) flag on ansible-playbook. Each one becomes a variable for the whole run.
ansible-playbook site.yml -e "env=prod"All lessons in this course
- Defining & Using vars in a Play
- The {{ }} Substitution Syntax
- Extra Vars on the Command Line
- Where Variables Come From & Precedence