If it is advisable go 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 identify outlined contained in the playbook.
You may as well learn up on Passing Variables On The Command Line (Wayback Machine hyperlink to keep up 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 can be enhanced with atmosphere variables:
vars:
my_version: "{{ lookup('env', 'model') }}"
my_other_variable: {{ lookup('env', 'other_variable') }}