Search code examples
jsonansibleansible-2.xrundeck

Proper syntax for adding Rundeck Ansible "Extra Vars"


Im using Rundeck 3.0.7 with Ansible 2.7 and cant figure out the correct syntax to pass variables to my Ansible playbook. If I run it from the command line it works fine.

ansible-playbook test-playbook.yml -i hosts -e "FirstName=John LastName=Doe OfficePhone=365"

However when I add those vars to the "Extra Variables" section of the Rundeck Job I add the following and it doesnt work.

-e "FirstName=John LastName=Doe OfficePhone=365"

Does anyone know the proper syntax?


Solution

  • In your workflow define your playbook extra arguments using options like:

    -e "test1=${option.test1} test2=${option.test2}"
    

    That way you get the values of options to those variable names in the arguments to ansible-playbook.