1

I'm planning to use the salt-cloud function to take a snapshot before applying a yum update patch.

the command that needs to be run on master is salt-cloud -a create_snapshot vmname snashot_name

I have a state sls file to run patching on target. Is it possible to have a mix of executing commands on both the target and the master?

Thanks.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207
Atlas
  • 19
  • 3

1 Answers1

1

Yes you can. Using orchestration.

Which is a build of states that run against the master. telling the master what to do.

an example i normally give that does both run runner functions and salt remote execution functions is this update script https://github.com/whytewolf/salt-phase0-orch/blob/master/orch/sys/salt/update.sls that runs through a large series of commands to update both master and all minions into a ready state.

for your example you would use a salt.runner calling https://docs.saltproject.io/en/latest/ref/runners/all/salt.runners.cloud.html#salt.runners.cloud.action followed by salt.state to call the state that runs the patching.

more about orchestration

whytewolf
  • 554
  • 2
  • 8
  • Thank you so much, and sorry for asking noob question. How do you call this or define the list of minions to be update? if it's a state file, I can target it with salt -L, but how do I do it with this script? – Atlas Jan 21 '22 at 20:26
  • orchestration is done on the master. it is called using salt-run such as `salt-run state.orch ` targeting the minions part of the states happens in the orchestration sls file. the states have a tgt function that tells the orchestration which minion to target for that function. you can handle that part using jinja to have a orchestration file that can be targeted at a minion/set of minions. this is all in the documentation i pointed to. – whytewolf Jan 21 '22 at 20:32