# Lost in group\_vars, append

**URL:** <https://forum.ansible.com/t/lost-in-group-vars-append/28553>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [September 11, 2018, 9:24pm UTC](https://forum.ansible.com/t/lost-in-group-vars-append/28553 "2018-09-11T21:24:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arturas\_R](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@Arturas\_R](https://forum.ansible.com/u/Arturas_R)\
**Post date:** [September 11, 2018, 9:24pm UTC](https://forum.ansible.com/t/lost-in-group-vars-append/28553/1 "2018-09-11T21:24:07Z")

</div>

Hello Community,

I could really use some help here. First of all, I would like to say, that I am with ansible for couple of days, so sorry in advance 🙂

My use case:

I am setting up ssh configuration for all hosts. I want to have default AcceptEnv for CentOS, but I have one hosts group which needs some extra AcceptEnv lines.

I am using sshd role [https://galaxy.ansible.com/willshersystems/sshd](https://galaxy.ansible.com/willshersystems/sshd)

What I have:

I have group\_vars/all with the following code

sshd:  
AcceptEnv:

- LANG LC\_CTYPE LC\_NUMERIC LC\_TIME LC\_COLLATE LC\_MONETARY LC\_MESSAGES
- LC\_PAPER LC\_NAME LC\_ADDRESS LC\_TELEPHONE LC\_MEASUREMENT
- LC\_IDENTIFICATION LC\_ALL LANGUAGE
- XMODIFIERS

I also have group\_vars/mygroup which needs to add extra line. If I just copy all info from group\_vars/all and add my extra lines, it is working.

What I want to achieve in group\_vars/mygroup is something like

`  
sshd:  
AcceptEnv: {{existing AcceptENV} + {{ my\_lines or temp\_var with lines }}

`

This is not working

temp\_var:  
AcceptNewEnv:

- EXTRA\_ENV\_VAR

sshd:  
AcceptEnv: “{{ sshd.AcceptEnv }} + {{ temp\_var.AcceptNewEnv }}”

I tried bunch of situations, didn’t get this to work. Any suggestions, I am a bit lost here.

Btw an error I get is

`Error was a <class 'ansible.errors.AnsibleError'>, original message: An unhandled exception occurred while templating '{u'AcceptEnv': u'{{ sshd.AcceptEnv }} + {{ temp_var.AcceptNewEnv }}'}'`

I’ve googled a lot about this error and I get the point, that’s a recursive call, but I do not think of a way to get existing value and add something more…
