# basic variable/list question

**URL:** <https://forum.ansible.com/t/basic-variable-list-question/13337>\
**Category:** Ansible Project\
**Created:** [August 20, 2013, 7:52pm UTC](https://forum.ansible.com/t/basic-variable-list-question/13337 "2013-08-20T19:52:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Lucas](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Michael\_Lucas](https://forum.ansible.com/u/Michael_Lucas)\
**Post date:** [August 20, 2013, 7:52pm UTC](https://forum.ansible.com/t/basic-variable-list-question/13337/1 "2013-08-20T19:52:41Z")

</div>

Hi,

I'm trying to use the authorized\_keys module with a list of keys per  
group. Basically, servers in group A get one set of authorized keys,  
while group B gets another set of authorized keys.

I clearly have some conceptual problems, however. Rather than ask what  
I think I need to know, I'd like to know the best way to solve this.  
I'm including the playbook and the list from my host file, in the hope  
someone can point me in the right direction.

I can copy user keys if I list the users in the playbook, but when I  
try to use a YAML list instead of the explicit name I get:

ERROR: variables assigned to group must be in key=value form

But I see examples of lists like this in the docs.

The playbook:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 21, 2013, 2:12am UTC](https://forum.ansible.com/t/basic-variable-list-question/13337/2 "2013-08-21T02:12:02Z")

</div>

“I can copy user keys if I list the users in the playbook, but when I  
try to use a YAML list instead of the explicit name I get:”

Can you share the playbook you were trying to pass in with the explicit list?

Would help me understand better what may be going wrongly there.

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_Lucas](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Michael\_Lucas](https://forum.ansible.com/u/Michael_Lucas)\
**Post date:** [August 21, 2013, 2:18am UTC](https://forum.ansible.com/t/basic-variable-list-question/13337/3 "2013-08-21T02:18:25Z")

</div>

Absolutely!

---

<div class="post-metadata">

**Author:** ![Michael\_Lucas](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@Michael\_Lucas](https://forum.ansible.com/u/Michael_Lucas)\
**Post date:** [August 21, 2013, 5:10pm UTC](https://forum.ansible.com/t/basic-variable-list-question/13337/4 "2013-08-21T17:10:25Z")

</div>

OK, I have this worked out. Posted for the next guy who needs to learn  
this:

I cannot put the list in the hosts file. A list in the group\_vars file  
works fine, though. So I have /etc/ansible/group\_vars/freebsd-test  
containing:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 22, 2013, 2:26am UTC](https://forum.ansible.com/t/basic-variable-list-question/13337/5 "2013-08-22T02:26:12Z")

</div>

Yep, exactly.

You can define complex variables in group\_vars/groupname, the INI file only accepts basic key=value stuff, which is where this error was coming up.
