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].
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/e76146e9-256a-41c0-b9b3-17a25d2e23b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.