Using "with_items" with yum will result in it joining package names with a
"," and grouping things into one transaction.

As such, when you use "with_items", you can't concatenate strings in the
parameter name

yum: name={{ item }} state=installed
with_items: package_list

Assuming you're using a package manager for downloading from repos, you'll
want to drop the extension anyway.


On Mon, Oct 6, 2014 at 8:18 AM, Dmitry Sukhodoyev <[email protected]>
wrote:

> hello. where is my mistake?
>
> yumtest:
> ---
> - hosts: test
>   vars:
>    generic_pkg_extension: "rpm"
>    generic_temp_dir: "/var/tmp"
>    file_packages:
>    - "daemontools-0.76-112memphis.x86_64"
>    - "libevent-1.4.13-500.el6.x86_64"
>    - "nginx-1.2.8-2.el6.x86_64"
>   tasks:
>   - name: "uploading packages from file"
>     copy: src="{{item}}.{{generic_pkg_extension}}"
> dest="{{generic_temp_dir}}/{{item}}.{{generic_pkg_extension}}"
>     with_items: file_packages
>   - name: installing packages from file
>     yum: name="{{generic_temp_dir}}/{{item}}.{{generic_pkg_extension}}"
> state="present"
>     with_items: file_packages
>
> I ran "ansible-playbook -i yumtest yumtest.yaml" and got:
> PLAY [test]
> *******************************************************************
>
> GATHERING FACTS
> ***************************************************************
> ok: [victim]
>
> TASK: [uploading packages from file]
> ******************************************
> ok: [victim] => (item=daemontools-0.76-112memphis.x86_64)
> ok: [victim] => (item=libevent-1.4.13-500.el6.x86_64)
> ok: [victim] => (item=nginx-1.2.8-2.el6.x86_64)
>
> TASK: [installing packages from file]
> *****************************************
> failed: [victim] =>
> (item=daemontools-0.76-112memphis.x86_64,libevent-1.4.13-500.el6.x86_64,nginx-1.2.8-2.el6.x86_64)
> => {"changed": false, "failed": true, "item":
> "daemontools-0.76-112memphis.x86_64,libevent-1.4.13-500.el6.x86_64,nginx-1.2.8-2.el6.x86_64",
> "rc": 0, "results": []}
> msg: No Package matching '/var/tmp/daemontools-0.76-112memphis.x86_64'
> found available, installed or updated
>
> FATAL: all hosts have already failed -- aborting
>
> if I leave in file_packages only one element, then result will success,
> but I need install several packages.
>
>  --
> 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/7f1c2fe5-079f-4563-bf00-ca90f77958f6%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/7f1c2fe5-079f-4563-bf00-ca90f77958f6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CA%2BnsWgwO1g7bug2mhoQYJ2RQhagfmmH2iCL1AcY%2BpfJmGvC8VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to