yum module localinstall many rpms from directory possible?

Hello

tasks:

  • name: yum local install
    yum: name=/sharedfilesystem/*.rpm state=present

Our team has several environments that lead up to our production environment, so patches must be applied and tested in one environment at a time (as they exist at a specific version ‘point-in-time’) so I can’t do a blind yum update latest in our production environment – therefore, I download the latest available at a point-in-time and apply them to each environment only once testing has succeeded in the previous environment.

Can ansible yum module help ‘localinstall’ patches that have been pre-downloaded? (I’ve only seen yum module work with a single rpm)

Maybe should be using command instead of yum module?

That's fine, look at with_items to get it all done in a single yum transaction.

The name support a list or comma separated listing.

So you could do something like this:

   - find:
       paths: /sharedfilesystem
       patterns: '*.rpm'
     register: r

   - yum:
       name: "{{ r.files | map(attribute='path') | list }}"

Success !!!

Some Learning Assumptions:

Success !!!!

Some Learning Assumptions:

So, this section I think I kinda get - it sets up 'r' to iterate through
the 'patterns' matches found beneath 'paths'.

register: r register the output of the find in the variable called r.
r can be anything, like result.

To see what the variable r contains you can use debug.

- debug: var=r

One of the returns is files, files is a list of all files find found.
Each list is a array with a lot of information about the file.

If you only want to show this list you can use debug

- debug: var=r.files

  - yum:
       name: "{{ r.files | map(attribute='path') | list }}"

As you can see if you run the debug above you'll see that each list item has many attributes, one of them is path.
Map filter gather all of them for each entry in the list r.files.

Map returns a object as you can see with

- debug: var="r.files | map(attribute='path')"

so we need to filter it to something useful, and since the yum module support list we make it a list.

- debug: var="r.files | map(attribute='path') | list"

Another use of debug is with msg.

- debug: msg="All files in a list - {{ r.files | map(attribute='path') | list }}"

This must iterate through each match and install it? Assumptions:

   - Install must be a default, since there's no sign of it.
   - map(attribute='path' expands to the absolute path of where the match
   is?
      - if so, why is path singlular here, and 'paths' plural is used
      above?
      - how is all this done on a 'name' line? because default yum
      behavior is install local...?
   - list iterates through matches registered to 'r' lets yum default
   install it?

I think the above answer all the questions.