Run script bash on saltstack master before minion

1k Views Asked by At

I allow myself to write to you, due to a block on my part at Salt.

I made a bash script that adds a host in my zabbix monitoring server. it works perfectly when I run .sh

the idea is that I want to automate this configuration through salt. I am when I do a highstate my state that contains the script runs in the master before minion because there's my login authentication in my bash script.

Is there's a special configuration for its? is what you have ideas how to do like this kind of setup? according to my research I found that to be used as the salt-runner but I do not know if this is good or not;

In anticipation of your return, I wish you a good weekend.

3

There are 3 best solutions below

0
On BEST ANSWER

If you need the highstate on the minion to cause something to occur on the master than you are going to want too look into using salt's Reactor (which is designed to do exactly this kind of multi-machine stuff).

0
On

Run a minion on the same box as your master, then you can run the script on your master's minion and then on the other server.

0
On

Thanks you, it's working, i used the cmd.script, and the script bash it works perfectly.

this is my state init
salt://script_API/Add_host_to_zabbix.sh:
  cmd.script:
    - env:
      - BATCH: 'yes'
    - args: 53 10466 10257

And i make salt "myMaster" state.highstate, and when i verify in my server zabbix i see a host is added in my zabbix monitoring server.

I do not know is good or not bu it's work ^^