Re: [ansible-project] Apt packages

19 views
Skip to first unread message
Message has been deleted

Johannes Kastl

unread,
May 6, 2016, 4:58:42 AM5/6/16
to ansible...@googlegroups.com
On 06.05.16 10:56 deo...@miranetworks.net wrote:
> Hi,
>
> Is it possible to pass list of packages with --extra-vars that needs to be
> installed with apt? I don't want to update the playbook everytime with list
> of package. Currently I can pass one package and it installed fine.

Use something like this:

apt: name="{{ item }}" ...
with_items: your_package_list

and call the playbook with

ansible-playbook -e 'your_package_list=[foo,bar,xyz]'

Untested!

Johannes

signature.asc
Message has been deleted

Johannes Kastl

unread,
May 6, 2016, 5:18:08 AM5/6/16
to ansible...@googlegroups.com
On 06.05.16 11:13 deo...@miranetworks.net wrote:
> Tried that and does not work.
>
> Apt sees it as "apt-get install [foo,bar]" instead of "apt-get install foo
> bar"

Damn, I get the list thing wrong each time..

https://docs.ansible.com/ansible/YAMLSyntax.html
fruits: ['Apple', 'Orange', 'Strawberry', 'Mango']

Try this: ansible-playbook -e "your_package_list=['foo','bar','xyz']"

Johannes

signature.asc

deo...@miranetworks.net

unread,
May 6, 2016, 5:29:03 AM5/6/16
to Ansible Project
Thanks, working now
Reply all
Reply to author
Forward
0 new messages