Greetings,
I’m trying to pass a data structure to a role, but it’s not working out. What have I done wrong?
main.yml:
Greetings,
I’m trying to pass a data structure to a role, but it’s not working out. What have I done wrong?
main.yml:
First you define image in the vars section, and then you overwrite image with itself when you call the role, you can't do that.
My intention is to pass it to the role not redefine it. What do you suggest?
You have a few options.
You don't need to pass them to the role, variables is global so you can use them directly in the role, image.one.state and image.one.path.
Instead of using the image variable in the role, you can rename it to img. But since variables is global in Ansible I would recommend to prefix variables in a role with the role name, so you could use test_image in the role.