func (m *UbuntuOneHostInstallTemplate) Render(pkg urknall.Package) { //ip := GetLocalIP() pkg.AddCommands("repository", Shell("wget -q -O- http://downloads.opennebula.org/repo/Ubuntu/repo.key | apt-key add -"), Shell("echo 'deb http://downloads.opennebula.org/repo/4.14/Ubuntu/14.04 stable opennebula' > /etc/apt/sources.list.d/opennebula.list"), UpdatePackagesOmitError(), ) pkg.AddCommands("depends", InstallPackages("build-essential genromfs autoconf libtool qemu-utils libvirt0 bridge-utils lvm2 ssh iproute iputils-arping make"), ) pkg.AddCommands("node", InstallPackages("opennebula-node"), ) pkg.AddCommands("verify", InstallPackages("qemu-system-x86 qemu-kvm cpu-checker"), And("kvm=`kvm-ok | grep 'KVM acceleration can be used'`"), ) pkg.AddCommands("vswitch", InstallPackages("openvswitch-common openvswitch-switch bridge-utils"), ) }
func (m *UbuntuOneRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("one", RemovePackage("opennebula opennebula-sunstone"), RemovePackages(""), PurgePackages("opennebula opennebula-sunstone"), ) }
func (m *UbuntuOneHostRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("onehost", RemovePackage("opennebula-node"), RemovePackages(""), PurgePackages("opennebula-node"), ) }
func (m *UbuntuRiakRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("riak", RemovePackage("riak"), RemovePackages(""), PurgePackages("riak"), Shell("dpkg --get-selections riak*"), ) }
func (m *UbuntuRabbitRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("rabbitmq", RemovePackage("rabbitmq-server"), RemovePackages(""), PurgePackages("rabbitmq-server"), Shell("dpkg --get-selections rabbitmq*"), ) }
func (m *UbuntuMegamCommonRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("megamcommon", RemovePackage("megamcommon"), RemovePackages(""), PurgePackages("megamcommon"), Shell("dpkg --get-selections megam*"), ) }
func (m *UbuntuMegamSnowflakeRemoveTemplate) Render(pkg urknall.Package) { pkg.AddCommands("megamsnowflake", Shell("service snowflake stop"), RemovePackage("megamsnowflake"), RemovePackages(""), PurgePackages("megamsnowflake"), Shell("dpkg --get-selections megam*"), ) }
func (m *UbuntuMegamGatewayInstallTemplate) Render(pkg urknall.Package) { pkg.AddCommands("repository", Shell("echo 'deb [arch=amd64] "+DefaultMegamRepo+"' > "+ListFilePath), UpdatePackagesOmitError(), ) pkg.AddCommands("megamgateway", InstallPackages("megamgateway"), ) }
func (m *UbuntuBridgeTemplate) Render(pkg urknall.Package) { // ip := GetLocalIP() pkg.AddCommands("setupbrdige", Shell(""), Shell("sudo echo '"+"%"+"oneadmin ALL=(root) NOPASSWD: /usr/bin/ovs-vsctl' >> //etc/sudoers.d/openvswitch"), Shell("sudo echo '"+"%"+"oneadmin ALL=(root) NOPASSWD: /usr/bin/ovs-ofctl' >> //etc/sudoers.d/openvswitch"), Shell("export BRIDGE_NAME='one'"), Shell("export NETWORK_IF='eth0'"), Shell("sudo ovs-vsctl add-br one"), Shell("sudo echo 'auto one' >> /etc/network/interfaces"), Shell("sudo ovs-vsctl add-port one eth0"), UpdatePackagesOmitError(), ) }
func (m *UbuntuOneInstallTemplate) Render(pkg urknall.Package) { ip := GetLocalIP() pkg.AddCommands("repository", Shell("wget -q -O- http://downloads.opennebula.org/repo/Ubuntu/repo.key | apt-key add -"), Shell("echo 'deb http://downloads.opennebula.org/repo/4.14/Ubuntu/14.04 stable opennebula' > /etc/apt/sources.list.d/opennebula.list"), UpdatePackagesOmitError(), ) pkg.AddCommands("one", InstallPackages("opennebula opennebula-sunstone ntp ruby2.0 ruby2.0-dev ruby-dev"), ) pkg.AddCommands("repo", Shell("echo 'oneadmin ALL = (root) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/oneadmin"), //Shell("sudo apt-get -y install ntp ruby2.0 ruby2.0-dev ruby-dev"), Shell("rm /usr/bin/ruby"), Shell("rm /usr/bin/gem"), Shell("ln -s /usr/bin/ruby2.0 /usr/bin/ruby"), Shell("ln -s /usr/bin/gem2.0 /usr/bin/gem"), Shell("sudo chmod 0440 /etc/sudoers.d/oneadmin"), Shell("sudo rm /usr/share/one/install_gems"), //Shell("sudo cp ~/install_gems /usr/share/one/install_gems"), Shell("sudo cp /usr/share/megam/megdc/conf/trusty/opennebula/install_gems /usr/share/one/install_gems"), Shell("sudo chmod 755 /usr/share/one/install_gems"), Shell("sudo /usr/share/one/install_gems sunstone"), Shell("sed -i 's/^[ \t]*:host:.*/:host: "+ip+"/' /etc/one/sunstone-server.conf"), Shell("sunstone-server start"), Shell("econe-server start"), Shell("sudo -H -u oneadmin bash -c 'one restart'"), Shell("service opennebula restart"), ) }
func (m *UbuntuMegamNilavuInstallTemplate) Render(pkg urknall.Package) { pkg.AddCommands("repository", Shell("echo 'deb [arch=amd64] "+DefaultMegamRepo+"' > "+ListFilePath), UpdatePackagesOmitError(), ) pkg.AddCommands("megamcommon", And("apt-get -y install megamcommon"), ) pkg.AddCommands("megamnilavu", InstallPackages("megamnilavu"), ) }
func (m *UbuntuCephRemoveTemplate) Render(pkg urknall.Package) { Host := host() pkg.AddCommands("purgedata", Shell("ceph-deploy purgedata `"+Host+"`"), ) pkg.AddCommands("forgetKeys", Shell("ceph-deploy forgetkeys"), ) pkg.AddCommands("purge", Shell("ceph-deploy purge "+Host+""), ) pkg.AddCommands("remove", Shell("sudo rm -r /var/lib/ceph/"), ) pkg.AddCommands("cephdeploy", Shell("sudo apt-get -y remove ceph-deploy ceph-common ceph-mds"), ) pkg.AddCommands("purgeceph", Shell("sudo apt-get -y purge ceph-deploy ceph-common ceph-mds"), ) pkg.AddCommands("autoremove", Shell("sudo apt-get -y autoremove"), ) pkg.AddCommands("run", Shell("sudo rm -r /run/ceph"), ) pkg.AddCommands("lib", Shell("sudo rm -r /var/lib/ceph"), ) pkg.AddCommands("log", Shell("sudo rm /var/log/upstart/ceph*"), ) pkg.AddCommands("cluster", Shell("sudo rm ~/ceph-cluster/*"), ) }
func (m *UbuntuCephInstallTemplate) Render(pkg urknall.Package) { Host := host() ip := GetLocalIP() pkg.AddCommands("cephuser", Shell(" echo 'Make ceph user as sudoer'"), ) pkg.AddCommands("sudoer", Shell("echo ' "+Ceph_user+" ALL = (root) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/"+Ceph_user+""), ) pkg.AddCommands("changepermission", Shell("sudo chmod 0440 /etc/sudoers.d/"+Ceph_user+""), ) pkg.AddCommands("startinstall", Shell("echo 'Started installing ceph'"), ) pkg.AddCommands("install", Shell("sudo echo deb http://ceph.com/debian-hammer/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list"), ) pkg.AddCommands("get", Shell("sudo wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add -"), ) pkg.AddCommands("update", Shell("sudo apt-get -y update"), ) pkg.AddCommands("cephDeployinstall", InstallPackages("ceph-deploy", "ceph-common", "ceph-mds", "dnsmasq", "openssh-server", "ntp", "sshpass"), ) pkg.AddCommands("ipaddress", Shell("IP_ADDR="+ip+""), ) pkg.AddCommands("entry", Shell("echo 'Adding entry in /etc/hosts'"), ) pkg.AddCommands("edithost", Shell("echo '"+ip+" "+Host+"'"), ) pkg.AddCommands("ssh", Shell("echo 'Processing ssh-keygen'"), ) pkg.AddCommands("adduser", AddUser("megdc", true), Shell("ssh-keygen -N '' -t rsa -f "+User_home+"/.ssh/id_rsa"), Shell("cp "+User_home+"/.ssh/id_rsa.pub "+User_home+"/.ssh/authorized_keys"), ) pkg.AddCommands("ipKnown_hosts", AddUser("megdc", true), WriteFile(""+User_home+"/.ssh/ssh_config", content, ""+Ceph_user+"", 0755), ) pkg.AddCommands("hostuser", AddUser(""+Ceph_user+"", true), WriteFile(""+User_home+"/.ssh/config", content2, ""+Ceph_user+"", 0755), ) pkg.AddCommands("makeosd", Shell("echo 'Making directory inside osd drive '"), ) pkg.AddCommands("osd1", Shell("mkdir "+Osd1+"/osd"), ) pkg.AddCommands("osd2", Shell("mkdir "+Osd2+"/osd"), ) pkg.AddCommands("osd3", Shell("mkdir "+Osd3+"/osd"), ) pkg.AddCommands("getip", Shell("ip3=`echo 103.56.92.24| cut -d'.' -f 1,2,3`"), ) pkg.AddCommands("cephconfig", Shell("echo 'Ceph configuration started...'"), ) pkg.AddCommands("conf", AddUser(""+Ceph_user+"", true), Shell("mkdir "+User_home+"/ceph-cluster"), Shell("cd "+User_home+"/ceph-cluster"), Shell("ceph-deploy new "+Host+" "), Shell("echo 'osd crush chooseleaf type = 0'"), Shell("echo 'public network = $ip3.0/24'"), Shell("echo 'cluster network = $ip3.0/24'"), Shell("ceph-deploy install "+Host+""), Shell("ceph-deploy mon create-initial"), Shell("ceph-deploy osd prepare "+Host+":"+Osd1+"/osd "+Host+":"+Osd2+"/osd "), Shell("ceph-deploy osd activate "+Host+":"+Osd1+"/osd "+Host+":"+Osd2+"/osd "), Shell("ceph-deploy admin "+Host+""), Shell("sudo chmod +r /etc/ceph/ceph.client.admin.keyring"), Shell("sleep 180"), Shell("ceph osd pool set rbd pg_num 150"), Shell("sleep 180"), Shell("ceph osd pool set rbd pgp_num 150"), ) pkg.AddCommands("copy", Shell("cp "+User_home+"/ceph-cluster/*.keyring /etc/ceph/"), ) pkg.AddCommands("complete", Shell("echo 'Ceph installed successfully.'"), ) }
func (m *UbuntuRabbitmqInstallTemplate) Render(pkg urknall.Package) { pkg.AddCommands("rabbitmq", UpdatePackagesOmitError(), InstallPackages("rabbitmq-server"), ) }