I’m trying to run this command from a bash script and pass the extra-vars from the bash arguments.
#!/bin/bash ansible-playbook /path/to/playbook.yml --extra-vars "var1=1 $@" > /path/to/log/file
I run the script like below and get this error:
> ./test.bs var2=2 var3=3 ERROR! the playbook: var3=3 could not be found
I even tried escaping the quotes but it didn’t work. How can I get this to run?
Advertisement
Answer
Or, you can change your script to use $*:
#!/bin/bash ansible-playbook /path/to/playbook.yml --extra-vars "var1=1 $*" > /path/to/log/file