Append to variables instead of overriding them

27 views
Skip to first unread message

Андрей Климентьев

unread,
Apr 5, 2017, 6:01:34 AM4/5/17
to Ansible Project, a.kli...@volga.rt.ru
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?

Benjamin Redling

unread,
Apr 5, 2017, 9:43:59 AM4/5/17
to ansible...@googlegroups.com
Hello Andrei,
Why not feed a list to the apt task anyway?
Many possibilities via loops
http://docs.ansible.com/ansible/playbooks_loops.html


Best regards,
Benjamin
--
FSU Jena | JULIELab.de/Staff/Benjamin+Redling.html
vox: +49 3641 9 44323 | fax: +49 3641 9 44321

Андрей Климентьев

unread,
Apr 6, 2017, 2:47:27 AM4/6/17
to Ansible Project
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.

среда, 5 апреля 2017 г., 16:43:59 UTC+3 пользователь Benjamin Redling написал:
Reply all
Reply to author
Forward
0 new messages