Another problem,
yum: name={{ item }} state=installed
with_items: [package1, package2]

install packages as yum install package1 package2
but your solution install packages as
yum install package1; yum install package2
that is rather slower. How this can be fixed?

On Fri, Feb 13, 2015 at 9:28 AM, Alexey Wasilyev <[email protected]>
wrote:

> Why you use local_action?
>
> On Fri, Feb 13, 2015 at 4:19 AM, Giovanni Tirloni <[email protected]>
> wrote:
>
>>
>>
>> On Thu, 12 Feb 2015 08:59 -0800, Alexey Wasilyev <[email protected]>
>> wrote:
>> > Hello, everybody.
>> >
>> > Can somebody show me the working example of following code?
>> >
>> > - name: 'Install packages'
>> >   action: >
>> >   {{ ansible_pkg_mgr }} name={{ item }} state=installed
>> >   with_items: [package1, package2]
>> >
>> > Without with_items - its worked. When I specify yum/apt instead  {{
>> > ansible_pkg_mgr }} - it's worked.
>> > How I can combine with_items and  {{ ansible_pkg_mgr }} together?
>>
>> Some valid ways to declare this:
>>
>>     - name: install packages
>>       local_action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
>>       with_items:
>>         - lsof
>>         - nmap
>>
>>     - name: install packages
>>       local_action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest"
>>       with_items: [ lsof, nmap ]
>>
>>     - name: install packages
>>       local_action: >
>>         {{ ansible_pkg_mgr }} name={{ item }} state=latest
>>       with_items: [ lsof, nmap ]
>>
>> Generally I try to use YAML only and avoid Ansible's syntax (with equal
>> signs). However, with free-form arguments, it's hard to avoid it. IMHO,
>> it's too much flexibility and backward compatibility, but that's because
>> I don't have a "legacy" code base to worry about.
>>
>> Giovanni
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/FbuUeSEBfOw/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/1423790393.1069199.226914481.0C5A232F%40webmail.messagingengine.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CANMXT8tQLq3KsPTwx0-VpNivzsQ4_s5m2ki%2B%2BVjT%3DzxC89M_8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to