1

I have installed nodejs on my salt-minion (Centos 6.6) using init.sls as,

manager-requirements:
  pkg.latest:
    - pkgs:
      - nodejs    

On minion, nodejs is installed and i am able to use it.

When i run config.get on salt-master to get the installation status, it returns blank entries.

salt '*' config.get pkg:nodejs

returns,

Minion-host-name:

I expected nodejs installation status as True in the return value but it is not there.

Is config.get the right interface to inquire about the installed packages in minions?

Saravana Kumar
  • 69
  • 1
  • 1
  • 6

1 Answers1

0

salt.modules.config is about the state of salt minion/master, you want salt.modules.pkg

salt '*' pkg.version nodejs python ruby    
salt '*' pkg.install nodejs
salt '*' pkg.install pkgs='["nodejs","python", "ruby"]'

Full docs are under the packager specific module: apt, yum, brew, pacman, pkgng, pkgin, ips, etc

Instead of asking salt to describe the state of the system ("Is package nodejs installed") or to do something ("Install package nodejs.") the preferred salt idiom is probably to check or enforce the state file or single state in question (whatever/init.sls) with state.sls

salt '*' state.sls whatever test=true           # does a dry run
salt '*' state.sls whatever                     # actually applies the state
salt '*' state.sls_id state_name whatever       # single state from whatever/init.sls

But to be honest the quick and dirty sanity check with cmd.run often wins out:

salt '*' cmd.run "node --version"
salt '*' cmd.run "dpkg -l |grep salt-minion""
notpeter
  • 3,505
  • 1
  • 24
  • 44