# convcert tags dict tags list?

**URL:** <https://forum.ansible.com/t/convcert-tags-dict-tags-list/27600>\
**Category:** Ansible Project\
**Created:** [May 23, 2018, 1:52pm UTC](https://forum.ansible.com/t/convcert-tags-dict-tags-list/27600 "2018-05-23T13:52:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [May 23, 2018, 1:52pm UTC](https://forum.ansible.com/t/convcert-tags-dict-tags-list/27600/1 "2018-05-23T13:52:34Z")

</div>

For some reason, the ec2\_asg module does not handle tags the same way as other modules.

Most modules let you do this:

tags:  
fred: wilma  
barney: betty

In the ec2\_asg module, that results in an error message about not being able to convert a dict to a list.

In the ec2\_asg module, I have to do something like this:

tags: [{fred: wilma}, {barney:betty}]

How can I do this automatically? How can I convert the former type to a variable I can use with ec2\_asg?

Regards, k.

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [May 24, 2018, 3:34am UTC](https://forum.ansible.com/t/convcert-tags-dict-tags-list/27600/2 "2018-05-24T03:34:52Z")

</div>

I figured it out. Given a set of tags in a dict as per usual, this generates a variable all\_tags which is a list of tags:

- set\_fact:  
tag\_list: 

- set\_fact:  
tag\_list: “{{ tag\_list + [{item.key: item.value}] }}”  
with\_dict: “{{ all\_tags }}”

The “tags” attribute in the ec2\_asg module accepts all\_tags and the ASG is then correctly tagged.

I think this is a bug in ec2\_asg. It should work the same as other modules.

Regards, K.
