# Argument passing

**URL:** <https://forum.ansible.com/t/argument-passing/18924>\
**Category:** Ansible Project\
**Created:** [August 3, 2015, 8:18am UTC](https://forum.ansible.com/t/argument-passing/18924 "2015-08-03T08:18:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zorggy01](https://avatars.discourse-cdn.com/v4/letter/z/76d3ee/32.png) [@zorggy01](https://forum.ansible.com/u/zorggy01)\
**Post date:** [August 3, 2015, 8:18am UTC](https://forum.ansible.com/t/argument-passing/18924/1 "2015-08-03T08:18:46Z")

</div>

Hello,

I’ve written a role including two python modules, one to provide Ansible with a list of new host names in order to create a dynamic group and another one using the list of all hosts. Here is a part of the main.yml file of the role:

`

- name: Get list of new hosts  
get\_new\_hosts:  
register: get\_new\_hosts\_return

- name: Create ‘new’ dynamic group  
add\_host: name={{ item }} group=new  
with\_items: get\_new\_hosts\_return.host\_list

- name: DEBUG… check full host list  
debug: msg={{ groups[‘all’] }}

- name: Run task using all hosts  
use\_all\_hosts: “{host\_list: {{ groups[‘all’] }}, arg2: ‘val\_2’, arg\_3: True}”  
`

In the debug task, host names are correctly displayed. Then I run the next python module using the inventory **groups[‘all’]**. You see that I send arguments as a YAML string and I just read them in the python module through the **yaml.load()** function. It works correctly but the problem is that I get arguments from the args file as:

`  
{host\_list: [‘host\_name\_1’, ‘host\_name\_2’, … , u’new\_host\_name\_1’, u’new\_host\_name\_2’, …], arg\_2: ‘val\_2’, arg\_3: True}

`

Host names from the dynamic group are written as the string **u’new\_host\_name’** that is not a Unicode string, just a Python representation of Unicode. Then I cannot read correct names except if I remove the **u’’** characters.

Is there something wrong in what I wrote? In such a case what?

Thank you in advance for your help.
