Install multiple named packages with 'community.general.zypper'

115 views
Skip to first unread message

Terry Lemons

unread,
Sep 18, 2023, 4:16:02 PM9/18/23
to Ansible Project
Hi - I need to install ~30 specific packages on a SLES 15 system using Ansible. Instead of specifying 30 individual 'community.general.zypper' tasks, I'd like to run a single 'community.general.zypper' task and provide it either with a long list of packages or a filename containing the package list. This doesn't seem to be possible, given my read of the 'community.general.zypper' documentation; is that true?

Thanks!
tl

Dick Visser

unread,
Sep 18, 2023, 4:20:29 PM9/18/23
to ansible...@googlegroups.com
On Mon, 18 Sept 2023 at 22:16, 'Terry Lemons' via Ansible Project <ansible...@googlegroups.com> wrote:
Hi - I need to install ~30 specific packages on a SLES 15 system using Ansible. Instead of specifying 30 individual 'community.general.zypper' tasks, I'd like to run a single 'community.general.zypper' task and provide it either with a long list of packages or a filename containing the package list. This doesn't seem to be possible, given my read of the 'community.general.zypper' documentation; is that true?

It is possible to supply a list:

Package name name or package specifier or a list of either.

 

Wei-Yen Tan

unread,
Sep 18, 2023, 4:28:02 PM9/18/23
to ansible...@googlegroups.com
It is possible. If not within the the module use with_items or loops. Give zypper a list 

Sent from Outlook for iOS

From: ansible...@googlegroups.com <ansible...@googlegroups.com> on behalf of Dick Visser <dnmv...@gmail.com>
Sent: Tuesday, September 19, 2023 8:19:55 AM
To: ansible...@googlegroups.com <ansible...@googlegroups.com>
Subject: Re: [ansible-project] Install multiple named packages with 'community.general.zypper'
 
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLY_8Eo-WveYazFQuSwB_ZqF54%3DcbU7DvVk7%2BmgjAJ89bQ%40mail.gmail.com.

Ansible Project

unread,
Sep 19, 2023, 9:33:37 AM9/19/23
to Ansible Project
Hi Wei-Yen and Dick

Thank you both for the fast replies. I found that multiple packages are support as a value to 'Name', but the values must be comma-separated.

Thanks again!
tl

Felix Fontein

unread,
Sep 19, 2023, 11:50:10 AM9/19/23
to ansible...@googlegroups.com
Hi tl,

you can also provide a YAML list.

See the documentation: it explicitly says `list / elements=string`.
https://docs.ansible.com/ansible/latest/collections/community/general/zypper_module.html#parameter-name

Providing a comma-separated string instead of a list is something
Ansible allows, but you do not have to do that.

Cheers,
Felix



On Tue, 19 Sep 2023 06:33:37 -0700 (PDT)
"'Ansible Project' via Ansible Project" <ansible...@googlegroups.com> wrote:

> Hi Wei-Yen and Dick
>
> Thank you both for the fast replies. I found that multiple packages
> are support as a value to 'Name', but the values must be
> comma-separated.
>
> Thanks again!
> tl
>
> On Monday, September 18, 2023 at 4:28:02 PM UTC-4 Wei-Yen Tan wrote:
>
> > It is possible. If not within the the module use with_items or
> > loops. Give zypper a list
> >
> > Sent from Outlook for iOS <https://aka.ms/o0ukef>
> > ------------------------------
> > *From:* ansible...@googlegroups.com <ansible...@googlegroups.com>
> > on behalf of Dick Visser <dnmv...@gmail.com>
> > *Sent:* Tuesday, September 19, 2023 8:19:55 AM
> > *To:* ansible...@googlegroups.com <ansible...@googlegroups.com>
> > *Subject:* Re: [ansible-project] Install multiple named packages
Reply all
Reply to author
Forward
0 new messages