Run extracted binary only if extracted

12 views
Skip to first unread message

brad.v...@gmail.com

unread,
Apr 13, 2023, 12:35:46 PM4/13/23
to Salt-users
We have some binaries for different flavors of Linux that need to get installed only if the version changes.  We put the binaries together in a archive because salt and gitfs were having trouble downloading the binaries directly.  We have some jinja that sets the SCRIPT variable based on the OS.  We have:

download_arch:
  archive.extracted:
    - source: salt:/software/files/file.tgz
    - name: /root/scripts
    - source_hash: 586...e4c
    - source_hash_update: True
    - user: root
    - group: root
    - mode: 0700
    - enforce_toplevel: false
    - if_missing: /root/scripts/{{ Script }}

run_file:
  cmd.run:
    - name: /root/scripts/{{ Script }}
    - onchanges:
      - file: download_arch

My onchanges is not correct.  I only want the script to run if a new archive is downloaded and extracted.

brad.v...@gmail.com

unread,
Apr 14, 2023, 5:52:16 AM4/14/23
to Salt-users
I got it fixed.  Changed to:

run_file:
  cmd.run:
    - name: /root/scripts/{{ Script }}
    - onchanges:
      - archive: download_arch

That is working.  :)
Reply all
Reply to author
Forward
0 new messages