FreeKB - --extra-vars (variables) command line option
Ansible - --extra-vars (variables) command line option

Command line option --extra-vars can be used to create variables on the command line, like this.

ansible-playbook playbook.yml --extra-vars "foo=Hello bar=World"


In this scenario, you would not define the variable in your playbook.yml file, but you would use the variable in your playbook.yml file.

- hosts: linux
    - debug: msg="{{ foo }}"


In this example, since debug was used, using the ansible-playbook command to run the playbook will produce the following output.

TASK [debug]
ok: [] => {
    "msg": "Hello World"


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 2d965 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |