On Thu, 10 Oct 2019 10:12:01 -0700 (PDT)
Spiro Mitsialis <[email protected]> wrote:

> The playbook is passed a variable called "port".  What I would like to 
> create a fact as below
> 
> set_fact:
>   temp_interface:
>     "{{ port }}":
>         name: "{{ port }}"
>         description: free
>         status: shutdown

Try this

   - set_fact:
        temp_interface: "{{ temp_interface|
                            default({})|
                            combine({port: {'name': port,
                                            'description': 'free',
                                            'status': 'shutdown'}})
                                            }}"
 

Cheers,

        -vlado

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20191010195334.4e54ff7a%40gmail.com.

Attachment: pgppRx9gxi8RM.pgp
Description: OpenPGP digital signature

Reply via email to