salt stack - Running post-provisioning action after multi-host vagrant provision -




i have vagrantfile takes salt-ssh roster , configures hosts each of entries.

i need use salt orchestrate runner finish off provisioning (specifically, configure redis cluster) after vms up.

does know way of doing this? know can provide list of orchestrations run on master.

but docs indicate it'd run on vagrant up, , given behaviour of other salt provisioning options, seems it'd run master came up, not after master , minions have come up.

can suggest way of executing salt orchestrations after vms , provisioned?

contents of vagrantfile:

require 'yaml' require 'resolv'  # run "vagrant plugin install vagrant-hostmanager" if produces error require 'vagrant-hostmanager'  box = "centos/7" roster = yaml::load(file.read("etc/salt/roster")) pattern = /.*lab.*/ master_pattern = /.*orchestrator.*/  # filter stuff we're not interested in roster = roster.select |hostname, roster_entry|     roster_entry.key?("host") && (pattern.nil? || pattern.match(hostname)) end  vagrant.configure("2") |config|   minion_certs = hash.new    # preseed /etc/hosts file on hosts, , update them new hosts   # provisioned.   config.hostmanager.enabled = true   config.hostmanager.manage_guest = true    setup_host = proc.new | hostname, roster_entry, is_master |     ip = resolv.getaddress(roster_entry["host"].to_s)      config.vm.define hostname.to_s |host_config|       host_config.vm.box = box       host_config.vm.hostname = hostname        # allow minions find master, adding entry /etc/hosts       host_config.hostmanager.aliases = "salt" if is_master        # setup inter-vm network (with real ips), , public network interwebs       host_config.vm.network :private_network, :ip => ip.to_s       host_config.vm.network :public_network, bridge: [         "en1: wi-fi (airport)",         "en0: ethernet",       ]        host_config.vm.provision :salt |salt|         if is_master           salt.install_master = true           salt.master_config = "etc/salt/vagrant-master"           salt.seed_master = minion_certs            salt.master_key = "etc/salt/pki/master.pem"           salt.master_pub = "etc/salt/pki/master.pub"         else           salt.minion_id = hostname           salt.minion_config = "etc/salt/vagrant-minion"         end          salt.run_highstate = true         salt.minion_key = "etc/salt/pki/minion.pem"         salt.minion_pub = "etc/salt/pki/minion.pub"         salt.install_type = "stable"         salt.verbose = false       end     end   end    # create hash of minions - used pre-accept minion certs on master   roster.each { |hostname, roster_entry| minion_certs[hostname] = "etc/salt/pki/minion.pub" }    # bring master *first*   roster.each |hostname, roster_entry|     next unless master_pattern.match(hostname)     setup_host.call(hostname, roster_entry, true)   end    # bring minions *last*   roster.each |hostname, roster_entry|     next if master_pattern.match(hostname)     setup_host.call(hostname, roster_entry, false)   end end 





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -