Other answers indicate how to pass command line variables, but not how to access them, so if you do:
--extra-vars "version=1.23.45 other_variable=foo"
In your yml file, you assign them to the covered variable variables, doing something like:
vars: my_version: "{{ version }}" my_other_variable: {{ other_variable }}
An alternative to using command line arguments is to use environment variables that are already defined in your session, you can reference them in your similar yml files as follows:
vars: my_version: "{{ lookup('env', 'version') }}" my_other_variable: {{ lookup('env', 'other_variable') }}
GreensterRox Feb 20 '17 at 15:06 2017-02-20 15:06
source share