If that you must move a variable to Ansible playbook, utilizing the command line, then you are able to do the next:
Possibility 1 – Specifying command line arguments
ansible-playbook launch.yml --extra-vars "model=1.23.45 other_variable=foo"
N.B. --extra-vars
specified variables will override any variables with the identical title outlined contained in the playbook.
You may as well learn up on Passing Variables On The Command Line (Wayback Machine hyperlink to take care of versioning)
Possibility 2 – Specify a YML file
You may as well specify a .yml
file with the variables:
vars:
my_version: "{{ model }}"
my_other_variable: {{ other_variable }}
This may also be enhanced with surroundings variables:
vars:
my_version: "{{ lookup('env', 'model') }}"
my_other_variable: {{ lookup('env', 'other_variable') }}