Problem on yum module on CentOS 7

258 views
Skip to first unread message

zorg...@gmail.com

unread,
Sep 26, 2014, 5:27:11 AM9/26/14
to ansible...@googlegroups.com
Hello,

I'm testing Ansible (version 1.7.1-1) on CentOS 7. Installation is minimalist then I need to install additional packages. Here is the playbook:
---
-
    hosts
: localhost
    remote_user
: root
    tasks
:
       
- name: install mandatory package list
          yum
: name={{ item }}, state=present
          with_items
:
             
- bc
...

Ansible raises an error:
failed: [localhost] => (item=bc) => {"changed": true, "failed": true, "item": "bc", "rc": 0, "results": ["Loaded plugins: changelog, fastestmirror, kernel-module, protectbase, tsflags,\n              : versionlock\nLoading mirror speeds from cached hostfile\n54 packages excluded due to repository protections\nResolving Dependencies\n--> Running transaction check\n---> Package bc.x86_64 0:1.06.95-13.el7 will be installed\n--> Finished Dependency Resolution\nBeginning Kernel Module Plugin\nFinished Kernel Module Plugin\n\nDependencies Resolved\n\n================================================================================\n Package      Arch             Version                     Repository      Size\n================================================================================\nInstalling:\n bc           x86_64           1.06.95-13.el7              base           115 k\n\nTransaction Summary\n================================================================================\nInstall  1 Package\n\nTotal download size: 115 k\nInstalled size: 215 k\nDownloading packages:\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  Installing : bc-1.06.95-13.el7.x86_64                                     1/1 \n  Verifying  : bc-1.06.95-13.el7.x86_64                                     1/1 \n\nInstalled:\n  bc.x86_64 0:1.06.95-13.el7                                                    \n\nComplete!\n"]}
msg
: No Package matching '' found available, installed or updated

FATAL
: all hosts have already failed -- aborting

Yum has done it's job (bc is actually installed), but Ansible seems to want to install an additional package named '' (nothing), which is obviously not present. Is this a bug or did I miss something?


Mark Maas

unread,
Sep 26, 2014, 6:55:04 AM9/26/14
to ansible...@googlegroups.com
I think it's because of the comma behind the }}  ?

Michael DeHaan

unread,
Sep 26, 2014, 8:24:50 AM9/26/14
to ansible...@googlegroups.com
Yes, take out out the comma.



--
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/4063c389-db5a-4894-93cd-c8d98b9b624f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

zorg...@gmail.com

unread,
Sep 26, 2014, 8:47:12 AM9/26/14
to ansible...@googlegroups.com
Thank you very much, without the comma it works perfectly.

However it was not the exact case, I simplified to extract just what was wrong. In fact I'm using a role and get the same error:
---
-
    hosts
: localhost
    remote_user
:
root
    roles
:
       
-   { role: installation, args: '{{ ansible_local.localhost.host_type }}', when: 'ansible_local.localhost.host_type is defined' }


I've just tried without commas, but Ansible complains about quotes just after the first missing comma. I tried quotes in various places but without any success. I suppose it's a syntax error again... Any idea?


On Friday, September 26, 2014 11:27:11 AM UTC+2, zorg...@gmail.com wrote:

zorg...@gmail.com

unread,
Sep 26, 2014, 8:54:32 AM9/26/14
to ansible...@googlegroups.com
Oops, I've finally found the error: it was deeper, in the task of the installation role:

-   name: install mandatory package list
    yum
: name={{ item }}, state=
present
    with_items
: packages

You see, in second line, there is a comma that should not be there! Removing it solves the difficulty. Thank you very much again!



On Friday, September 26, 2014 11:27:11 AM UTC+2, zorg...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages