Hi,

I start to work with Ansible lately. 

I would like to run 'yum install' on a list of packages. I have:

*- name: install these items*
*  yum:*
*    name: "{{item}}"*
*    exclude: package4**
*    update_cache: yes*
*    state: present*
*    skip_broken: yes*
*  with_lines: cat "path_to_file/yum_packages.txt"*

  
File yum_packages.txt contain:

package1
package2
package3
package4


1. The exclude ignored, it trying to install package4 even that it in the 
exclude line.
    I tried also to read the package in different way:
      *with_items:*
*      - package1*
*      - package2*

*      - package3*
*      - package4*
    Still dont work.

2. It give me a message that 'with_lines' & 'with_items' deprecation and 
should use the 'loop' instead. when I change it to 'loop' if said that :

Invalid data passed to 'loop' it requires a list, got this instead: cat 
\"/path/to/file/yum_packages.txt\" 

    'loop' work okay with a fix list like:
    loop:
  - package1
  - package2
     ...
   How can I read with 'loop' data from a file?

Thanks.


-- 
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/d40ccf5b-35e7-448e-83a4-6d84772299e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to