diff --git a/Vagrantfile b/Vagrantfile index 8406800b0ca89d8014912071a2a00ca742817f38..ea278c2f5116acfd9313a90854ef3438158ac0ee 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,18 +3,39 @@ Vagrant.configure("2") do |config| - # don't configure host-specific keys, config will use the user's key - config.ssh.insert_key = false + config.ssh.username = 'centos' + config.vm.allowed_synced_folder_types = [:rsync] + #config.ssh.private_key_path = "~/.ssh/id_rsa.pub" + #config.vm.synced_folder '.', '/vagrant', disabled: true, type: 'rsync' + + config.vm.provider :openstack do |os| + os.openstack_auth_url = 'http://ruffner.rc.uab.edu:5000/v3' + os.identity_api_version = '3' + os.image = 'CentOS-7-x86_64-GenericCloud-1905' + os.floating_ip_pool = 'bright-external-flat-externalnet' + + os.flavor = 'm1.medium' + os.project_name = "******" + os.user_domain_name = "default" + os.project_domain_name = "default" + os.username = "*****" + os.tenant_name = "*****" + os.password = "*****" + os.region = "openstack" + os.networks = ['dmznet','clusternet'] + #os.keypair_name = "MacBook" + os.security_groups = ["default"] + end config.vm.define "ohpc" do |ohpc| - ohpc.vm.box = "centos/7" - # version placeholder for selecting specific vagrant boxes - # used mainly for debugging and sanity checking - # leave commented to use the latest version in the local cache - #ood.vm.box_version = "1804.02" - ohpc.vm.hostname = "ohpc" - ohpc.vm.network "private_network", ip: "10.1.1.1", virtualbox__intnet: "compute" - #ohpc.vm.customize ["modifyvm", :id, "--name", "ohpc"] + + ohpc.ssh.host = '164.111.161.145' + ohpc.vm.hostname = "ohpc" + ohpc.vm.provider :openstack do |ohpc| + + ohpc.server_name = 'ohpc' + ohpc.floating_ip = "192.168.16.145" + end end config.vm.define "ood" do |ood| @@ -31,30 +52,30 @@ Vagrant.configure("2") do |config| auto_correct: true end - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - vb.memory = "2048" - end + # define user's key and insecure default # insecure default is required for initial provisioning - config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"] + #config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"] # append user's key to vagrant config to avoid overwrite of existing authorized_keys # https://stackoverflow.com/a/31153912/8928529 - config.vm.provision "ssh_pub_key", type: "shell" do |s| - ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip - s.inline = <<-SHELL - echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys - SHELL - end + #config.vm.provision "ssh_pub_key", type: "shell" do |s| + # ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip + # s.inline = <<-SHELL + # echo #{ssh_pub_key} >> /home/centos/.ssh/authorized_keys + # SHELL + #end config.vm.provision "shell", inline: <<-SHELL if [ -f /vagrant/localenv.sh ]; then . /vagrant/localenv.sh fi - + hostnamectl set-hostname ohpc yum install -y epel-release yum install -y ansible git vim bash-completion + yum install -y NetworkManager + systemctl restart NetworkManager + nmcli con mod "Wired connection 1" connection.id "eth1" ansible-playbook -c local -i /vagrant/CRI_XCBC/hosts -l `hostname` /vagrant/CRI_XCBC/site.yaml -b SHELL diff --git a/network_create b/network_create new file mode 100755 index 0000000000000000000000000000000000000000..c1af293417fffa09d4db75a953eaa45b3c596897 --- /dev/null +++ b/network_create @@ -0,0 +1,21 @@ +#!/bin/bash + +# Create the dmz and cluster networks as the external and +# internal networks of the ohpc cluster + +# create the dmz network for the head node to attach +openstack network create dmznet + +openstack subnet create --subnet-range 192.168.100.0/24 --dns-nameserver 8.8.8.8 --network dmznet dmzsubnet + +# connect dmz to the internet +openstack router create borderrouter + +openstack router set borderrouter --external-gateway bright-external-flat-externalnet + +openstack router add subnet borderrouter dmzsubnet + +# create the cluster network for the compute nodes +openstack network create clusternet + +openstack subnet create --subnet-range 10.1.1.0/24 --no-dhcp --network clusternet clustersubnet diff --git a/network_delete b/network_delete new file mode 100755 index 0000000000000000000000000000000000000000..b6b62c48903553df9bd0b99dc9c0d8eb69cf787b --- /dev/null +++ b/network_delete @@ -0,0 +1,14 @@ +#!/bin/bash + +# delete the dmz and cluster networks as the external and +# internal networks of the ohpc cluster + +# delete the dmz network for the head node to attach +openstack router remove subnet borderrouter dmzsubnet +openstack network delete dmznet + +# remove connect dmz to the internet +openstack router delete borderrouter + +# delete the cluster network for the compute nodes +openstack network delete clusternet