Reputation: 3354
Is there a way to override an Ansible variable by passing it as an --extra-var
/-e
from the CLI. The catch is that the variable I want to override is a list and I can't figure out the correct syntax.
Here's what the variable looks like in my group_vars
file:
my_variable:
- { var1: "value1", var2: "value2" }
...
Here's what my command looks like:
ansible-playbook -i inventory playbook.yml -e 'my_variable={ var1: value1, var2: value2 }' --limit 1.2.3.4 --diff --check
I get the following error:
fatal: [1.2.3.4] => with_items expects a list or a set
Is this possible? What am I doing wrong?
Upvotes: 3
Views: 7134