Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Using ansible to install previously downloaded patches.

    Posted on

    I've got some hosts that need to get a snapshot of available at the time that other systems are being updated.

    It is considered critical that these systems get exactly what was available to them right then, and not anything that comes out in the interim days between downloading and installing those patches.

    In the past I've solved this by doing a download only on the ones that have to wait, and then installing them from those local files later.

    I'm working on using ansible to accomplish this.

    My download only playbook looks like this, and works just fine.

    ---
     - hosts: inventory.names
    
       strategy: free
       become_user: root
       become: yes
       become_method: sudo
    
    
       tasks:
           #   - name: create a temp directory
       - file:
           path: /temp-dir/
           state: directory
           owner: me
           group: me
           mode: 0644
    
       - name: run yum update and download only
         yum:
           name: '*'
           state: latest
           download_dir: /temp-dir
           download_only: yes
    
    

    So, again, this one works. I get that its not perfect, but it works. Later I hope to combine the playbook I use to update the others, with this one so that I can do it all from one script.

    In any case, my question is this. How do I install those packages from a playbook, without knowing those package names?

    I was trying this:

    ---
     - hosts: a.test.system
    
       strategy: free
       become_user: root
       become: yes
       become_method: sudo
    
    
       tasks:
       - name: run yum update from previously downloaded files.
         yum:
           name: "{{ item }}"
           state: present
           with_fileglob:
             - "{{/timp2/*.rpm}}"
    
    

    This seems good according to yml syntax, but isnt working as expected.


    playbooks]$ ansible-playbook -K yumupdatelocal.yml BECOME password: PLAY [test.system] ******************************************************************************************* TASK [Gathering Facts] ********************************************************************************************** ok: [test.system] TASK [run yum update from previously downloaded files.] ************************************************************* fatal: [test.system]: FAILED! => {"msg": "template error while templating string: unexpected '/'. String: {{/timp2/*.rpm}}"} PLAY RECAP ********************************************************************************************************** test.system : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

    So, I could use help in two places.

    1, what am I doing wrong in this playbook.

    2, If there is a better way to do this, please enlighten me. I'd LOVE to be able to just use options with the yum module to make it install from local files, without already having a list, I just cant see how to do it.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat