How to use an "if" when provisioning through shell scripts?

I want to create three machines using Vagrant. After setting up these machines I want to use shell scripts on each machine (each script is different and it should be executed according to the name/hostname/ip of each machine)
By example if the hostname of a machine is “machine1” then should be executed “machine1.sh” and so on…
and if the hostname of the secondmachine is “machine2” then should be executed “machine2.shs”

I want to use conditionals! but I don’t know how to use them on vagrant (I don’t know rubby)

My actual Vagrantfile is this:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
BOX_IMAGE = "centos/7"

submit = [
{ :name => "submit", :ip   => "192.168.50.10" }
]

execute = [
  { :name => "execute", :ip => "192.168.50.20" },
  ]

central = [
  { :name => "central", :ip => "192.168.50.30" },
  ]

Vagrant.configure("2") do |config|

# submit #

  submit.each do |opts|
    config.vm.define opts[:name] do |config|
      config.vm.hostname =opts[:name]
      config.vm.box = BOX_IMAGE
      config.vm.network "private_network", ip: opts[:ip], virtualbox__intnet: "condor"
      config.vm.provision "shell", path: "scripts/submit.sh"
    end
  end

# execute #
  execute.each do |opts|
    config.vm.define opts[:name] do |config|
      config.vm.hostname =opts[:name]
      config.vm.box = BOX_IMAGE
      config.vm.network "private_network", ip: opts[:ip], virtualbox__intnet: "condor"
      config.vm.provision "shell", path: "scripts/execute.sh"

    end
  end

# central #
central.each do |opts|
  config.vm.define opts[:name] do |config|
    config.vm.hostname =opts[:name]
    config.vm.box = BOX_IMAGE
    config.vm.network "private_network", ip: opts[:ip], virtualbox__intnet: "condor"
    config.vm.provision "shell", path: "scripts/central.sh"
  end
end


end```