Jonathan,

Thanks for the idea but that's not it. I even cut and paste the text from 
https://docs.ansible.com/ansible/latest/modules/yum_module.html#yum-module:

- name: Install a list of packages
  yum:
    name:
      - nginx
      - postgresql
      - postgresql-server
    state: present

Into my playbook and when I run it I still get:

fatal: [IPADDRESS]: FAILED! => {
    "ansible_facts": {
        "pkg_mgr": "yum"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "conf_file": null,
            "disable_gpg_check": false,
            "disablerepo": null,
            "enablerepo": null,
            "install_repoquery": true,
            "list": null,
            "name": "['nginx', 'postgresql', 'postgresql-server']",
            "state": "present",
            "update_cache": false
        }
    },
    "msg": "No Package matching '['nginx'' found available, installed or 
updated",
    "rc": 0,
    "results": []
}

Yet on the machine in question:

# yum search nginx
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
229 packages excluded due to repository priority protections
======================================================== N/S matched: nginx 
=========================================================
collectd-nginx.x86_64 : Nginx plugin for collectd
munin-nginx.noarch : NGINX support for Munin resource monitoring
nextcloud-nginx.noarch : Nginx integration for NextCloud
nginx-all-modules.noarch : A meta package that installs all available Nginx 
modules
nginx-filesystem.noarch : The basic directory layout for the Nginx server
nginx-mod-http-geoip.x86_64 : Nginx HTTP geoip module
nginx-mod-http-image-filter.x86_64 : Nginx HTTP image filter module
nginx-mod-http-perl.x86_64 : Nginx HTTP perl module
nginx-mod-http-xslt-filter.x86_64 : Nginx XSLT module
nginx-mod-mail.x86_64 : Nginx mail modules
nginx-mod-stream.x86_64 : Nginx stream modules
owncloud-nginx.noarch : Nginx integration for ownCloud
pcp-pmda-nginx.x86_64 : Performance Co-Pilot (PCP) metrics for the Nginx 
Webserver
python2-certbot-nginx.noarch : The nginx plugin for certbot
nginx.x86_64 : A high performance web server and reverse proxy server

This still seems to be some kind of bug in yum module parsing the list?


On Saturday, 26 January 2019 15:38:52 UTC, Jonathan Lozada De La Matta 
wrote:
>
> as you mentioned towards the end and how the documentation is how to do 
> it. Giving a list to name is how I do it. In the example oracle prequesites 
> looks like you need two spces after name for reach rpm you are installing.
>
> so like 
>
> name:
>   - nginx
>
>
>
> On Sat, Jan 26, 2019 at 10:11 AM Byron Schlemmer <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I'm having a problem installing RPMs using the yum module from a list. 
>> Using version:
>>
>> $ ansible --version
>> ansible 2.7.6.post0 (stable-2.7 f759b5463b) last updated 2019/01/26 
>> 09:42:08 (GMT +000)
>>   python version = 2.7.5 (default, Aug  2 2016, 04:20:16) [GCC 4.8.5 
>> 20150623 (Red Hat 4.8.5-4)]
>>
>> When running a playbook as follows, yum installs, but executes a separate 
>> "yum install" for each item (which is expected but slow):
>>
>> - name: install pre-requisites
>>   yum:
>>     name: "{{ item }}"
>>     state: present
>>     use_backend: yum
>>   loop:
>>     - package1
>>     - package2
>>     - package3
>>
>> However, trying to following the deprecation warning:
>>
>> [DEPRECATION WARNING]: Invoking "yum" only once while using a loop via 
>> squash_actions is deprecated. Instead of using a loop to supply multiple 
>> items and specifying `name: "{{ item }}"`, please use `name: ['package1', 
>> package2', 'package3']` and remove the loop.This feature will be removed in 
>> version 2.11. Deprecation warnings can be disabled by setting 
>> deprecation_warnings=False in ansible.cfg.
>>
>> However if I try to do so with:
>>
>> - name: install oracle pre-requisites 1
>>   yum:
>>     name:
>>     - package1
>>     - package2
>>     - package3
>>
>> or with
>>
>> - name: install oracle pre-requisites 1
>>   yum:
>>     name: [package1, package2, package3]
>>
>> I get the error:
>>
>> failed: [1.1.1.1] (item=[u'package1', u'package2', u'package3']) => 
>> {"changed": false, "item": ["package1", "package2", "package3"], "msg": "No 
>> Package matching *'['package1''* found available, installed or updated", 
>> "rc": 0, "results": []}
>>
>> The error shows ['package1' in quotes which seems to indicate some kind 
>> of list miscomprehension?
>>
>> Can anyone spot what I'm doing wrong. 
>>
>> I've tried:
>>  - with/out quotes
>>  - inline or box layout yaml form for the list
>>  - i can install fine via separate yum module calls or using the loop 
>> mechanism and by extension manually as one transaction on the host itself.
>>
>> The documentation and source list this as an example but I get the same 
>> errors as above:
>>
>> - name: Install a list of packages
>>   yum:
>>     name:
>>       - nginx
>>       - postgresql
>>       - postgresql-server
>>     state: present
>>
>> Can anyone see what I'm doing wrong?
>>
>>
>>
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/e76146e9-256a-41c0-b9b3-17a25d2e23b4%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/e76146e9-256a-41c0-b9b3-17a25d2e23b4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
>
> Jonathan lozada de la matta
>
> AUTOMATION PRACTICE
>
>
>  
>
>

-- 
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/6c3e4c9a-bf63-41ad-acc9-16800d610286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to