If it is possible to add a list variable as extra-vars
xiangpingjiang opened this issue · comments
ansible-playbook arcade.yml --extra-vars '{"pacman":"mrs","ghosts":["inky","pinky","clyde","sue"]}'
in the example of go-ansible:
ansiblePlaybookOptions.AddExtraVar("app_name", app_name)
The value of the extra-vars must be string?
If it is possible to add a list variable as extra-vars?
Thank you very much
hi @xiangpingjiang
As you could see on the link below AddExtraVar
method accepts an interface{} as value, then it can be an slice, int, bool,.. or even another map.
https://github.com/apenella/go-ansible/blob/master/pkg/playbook/ansiblePlaybook.go#L414
Following your ansble-playbook
command, you need to define the ghosts values on a slice and then pass it as value.
ghosts_values := []string{"inky","pinky","clyde","sue"}
playbook.AddExtraVar("ghosts", ghosts_values)
Do you have anyother question?
Thanks!