# Append to variables instead of overriding them

**URL:** <https://forum.ansible.com/t/append-to-variables-instead-of-overriding-them/24146>\
**Category:** Ansible Project\
**Created:** [April 5, 2017, 10:01am UTC](https://forum.ansible.com/t/append-to-variables-instead-of-overriding-them/24146 "2017-04-05T10:01:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user20](https://avatars.discourse-cdn.com/v4/letter/u/a587f6/32.png) [@user20](https://forum.ansible.com/u/user20)\
**Post date:** [April 5, 2017, 10:01am UTC](https://forum.ansible.com/t/append-to-variables-instead-of-overriding-them/24146/1 "2017-04-05T10:01:34Z")

</div>

Hello.

Is it possible to append variable to another one in vars files?

I have a use case for this: I want to create a large list of packages to install on a Debian system. I have global packages (e.g, tmux), that I want to be available everywhere, group specific variables, defined in group\_vars, and host specific variables, that are defined in host\_vars. Is it possible to somehow concatenate those variables to feed resulting list to the apt module?

---

<div class="post-metadata">

**Author:** ![Benjamin\_Redling](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Benjamin\_Redling](https://forum.ansible.com/u/Benjamin_Redling)\
**Post date:** [April 5, 2017, 1:43pm UTC](https://forum.ansible.com/t/append-to-variables-instead-of-overriding-them/24146/2 "2017-04-05T13:43:39Z")

</div>

Hello Andrei,

---

<div class="post-metadata">

**Author:** ![user20](https://avatars.discourse-cdn.com/v4/letter/u/a587f6/32.png) [@user20](https://forum.ansible.com/u/user20)\
**Post date:** [April 6, 2017, 6:47am UTC](https://forum.ansible.com/t/append-to-variables-instead-of-overriding-them/24146/3 "2017-04-06T06:47:27Z")

</div>

Hello Benjamin,

well the problem is if I want to combine multiple lists, I’ll have to define 3 different variables for group\_vars/all, group\_vars/group, and host\_vars/host. I guess, it’s inescapable.
