issues with yum

63 views
Skip to first unread message

Dmitry Sukhodoyev

unread,
Oct 6, 2014, 8:18:34 AM10/6/14
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Oct 6, 2014, 8:28:21 AM10/6/14
to ansible...@googlegroups.com
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.


--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7f1c2fe5-079f-4563-bf00-ca90f77958f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry Sukhodoyev

unread,
Oct 6, 2014, 9:34:18 AM10/6/14
to ansible...@googlegroups.com
I trying to install several packages from local machine, which missed in any repos. Obviously my code will not work, so which is correct way to do it without setting up my own repos?

May be is there a way to prepare second list with pathnames and extensions from file_packages list by ansible to use it at yum module?
Reply all
Reply to author
Forward
0 new messages