0

I have a Salt formula that runs on my minions, and it runs a custom module that reaches out to the web for some JSON data for the latest version of chrome. It works great, but I thought it would be better to run it as a runner on the master and store it as pillar data for the minions to access. That way I don't have hundreds of minions querying the web unnecessarily vs just once on the master.

I'm not finding anything helpful online. Is it even possible?

def latest():

    import json
    import urllib.request

    url = 'https://omahaproxy.appspot.com/all.json'
    resp = urllib.request.urlopen(url)

    data = json.loads(resp.read())

    for each in data:
        if each.get("os") == "win":
            versions = each.get("versions")
            for version in versions:
                if version.get("channel") == "stable":
                    latest = (version.get("current_version"))
    return latest

I can run it as is in /etc/salt/_modules, as well as a runner in /etc/salt/_runners on the master.

evenyougreg
  • 85
  • 1
  • 6

0 Answers0