Create list in playbook (Fortigate automation)

Hi everybody,

I’m using Ansible to automate Fortigate Firewalls provisioning and I’m having the following problems.

  1. I have a playbook that first creates a couple of object addresses using one module (task Configure one fortinet address)
  2. Then I want the playbook to pass a list with the name of the objects just created to another module in order to group the addresses I’ve just created. I tried to use Jinja2 within a playbook but I realized it doesn’t work (I’m a newbie don’t judge me lol)
  3. I’m using the with_item loop but this does not work as the module expects a list with all the objects included as one argument. With_items command calls the module twice which does not work to group the objects :cry:
    Is there a way to do that with Jinja2 or by using some other strategy? Any help or orientation would help me.

Thanks for you time, playbook is below =)

`