Ejemplo n.º 1
0
func (m *DebianCreateNetworkTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("ovs-createnetwork",
		u.Shell("sudo echo '"+"%"+"oneadmin ALL=(root) NOPASSWD: /usr/bin/ovs-vsctl' > //etc/sudoers.d/openvswitch"),
		u.Shell("sudo echo '"+"%"+"oneadmin ALL=(root) NOPASSWD: /usr/bin/ovs-ofctl' >> //etc/sudoers.d/openvswitch"),
		u.Shell("sudo ovs-vsctl add-br "+m.BridgeName),
		u.Shell("sudo echo 'auto "+m.BridgeName+"' >> /etc/network/interfaces"),
		u.Shell("sudo ovs-vsctl add-port "+m.BridgeName+" "+m.PhyDev+""),
		u.UpdatePackagesOmitError(),
	)

}
func (m *DebianGatewayRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("verticegateway",
		u.RemovePackage("verticegateway"),
		u.RemovePackages(""),
		u.PurgePackages("verticegateway"),
		u.Shell("dpkg --get-selections megam*"),
	)
	pkg.AddCommands("verticegateway-clean",
		u.Shell("rm -r /var/lib/urknall/gateway*"),
	)
}
Ejemplo n.º 3
0
func (m *DebianNilavuRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("verticenilavu",
		u.RemovePackage("verticenilavu"),
		u.RemovePackages(""),
		u.PurgePackages("verticenilavu"),
		u.Shell("dpkg --get-selections megam*"),
	)
	pkg.AddCommands("nilavu-clean",
		u.Shell("rm -r /var/lib/urknall/nilavu*"),
	)
}
Ejemplo n.º 4
0
func (m *DebianMegamCommonRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("verticecommon",
		u.RemovePackage("verticecommon"),
		u.RemovePackages(""),
		u.PurgePackages("verticecommon"),
		u.Shell("dpkg --get-selections megam*"),
	)
	pkg.AddCommands("common-clean",
		u.Shell("rm -r /var/lib/urknall/common*"),
	)
}
func (m *DebianSnowflakeRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("verticesnowflake",
		u.Shell("systemctl stop snowflake"),
		u.RemovePackage("verticesnowflake"),
		u.RemovePackages(""),
		u.PurgePackages("verticesnowflake"),
		u.Shell("dpkg --get-selections megam*"),
	)
	pkg.AddCommands("snowflake-clean",
		u.Shell("rm -r /var/lib/urknall/snowflake*"),
	)
}
func (m *DebianMegamCommonInstallTemplate) Render(pkg urknall.Package) {

	pkg.AddCommands("repository",
		u.Shell("echo 'deb [arch=amd64] "+DefaultMegamRepo+"' > "+ListFilePath),
		u.UpdatePackagesOmitError(),
	)
	pkg.AddCommands("verticecommon",
		u.InstallPackages("verticecommon"),
	)
}
Ejemplo n.º 7
0
func (m *DebianOneRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("one",
		u.RemovePackage("opennebula opennebula-sunstone"),
		u.RemovePackages(""),
		u.PurgePackages("opennebula opennebula-sunstone"),
	)
	pkg.AddCommands("one-clean",
		u.Shell("rm -r /var/lib/urknall/one.*"),
	)
}
Ejemplo n.º 8
0
func (m *DebianOneHostRemoveTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("onehost",
		u.RemovePackage("opennebula-node openvswitch-common openvswitch-switch bridge-utils sshpass"),
		u.RemovePackages(""),
		u.PurgePackages("opennebula-node openvswitch-common openvswitch-switch bridge-utils sshpass"),
	)
	pkg.AddCommands("onehost-clean",
		u.Shell("rm -r /var/lib/urknall/onehost*"),
	)
}
Ejemplo n.º 9
0
func (m *DebianSshPassTemplate) Render(pkg urknall.Package) {

	pkg.AddCommands("install-sshpass",
		u.InstallPackages("sshpass"),
	)
	pkg.AddCommands("SSHPass",
		u.AsUser("oneadmin", u.Shell("sshpass -p 'oneadmin' scp -o StrictHostKeyChecking=no /var/lib/one/.ssh/id_rsa.pub oneadmin@"+m.Host+":/var/lib/one/.ssh/authorized_keys")),
		u.WriteFile("/var/lib/one/.ssh/config", KnownHostsList, "oneadmin", 0755),
	)
}
func (m *DebianGatewayInstallTemplate) Render(pkg urknall.Package) {
	//fail on Java -version (1.8 check)
	pkg.AddCommands("repository",
		u.Shell("echo 'deb [arch=amd64] "+DefaultMegamRepo+"' > "+ListFilePath),
		u.UpdatePackagesOmitError(),
	)

	pkg.AddCommands("verticegateway",
		u.InstallPackages("verticegateway"),
	)
}
Ejemplo n.º 11
0
func (m *DebianNilavuInstallTemplate) Render(pkg urknall.Package) {
	//fail on ruby2.0 < check

	pkg.AddCommands("repository",
		u.Shell("echo 'deb [arch=amd64] "+DefaultMegamRepo+"' > "+ListFilePath),
		u.UpdatePackagesOmitError(),
	)

	pkg.AddCommands("verticenilavu",
		u.InstallPackages(" sdfaskld verticenilavu"),
	)

}
Ejemplo n.º 12
0
func (m *DebianOneHostInstallTemplate) Render(pkg urknall.Package) {
	pkg.AddCommands("repository",
		u.InstallPackages("sudo"),
		u.Shell("wget -q -O- http://downloads.opennebula.org/repo/Debian/repo.key | apt-key add -"),
		u.Shell("echo 'deb http://downloads.opennebula.org/repo/4.14/Debian/8 stable opennebula' > /etc/apt/sources.list.d/opennebula.list"),
		u.UpdatePackagesOmitError(),
	)
	pkg.AddCommands("depends",
		u.InstallPackages("qemu-system-x86 qemu-kvm libvirt-bin build-essential genromfs autoconf libtool qemu-utils libvirt0 bridge-utils lvm2 ssh iproute iputils-arping make"),
	)

	pkg.AddCommands("one-node",
		u.InstallPackages("opennebula-node"),
	)
	pkg.AddCommands("node",
		u.Shell("sudo usermod -p $(echo oneadmin | openssl passwd -1 -stdin) oneadmin"),
	)
	pkg.AddCommands("vswitch",
		u.InstallPackages("openvswitch-common openvswitch-switch bridge-utils"),
	)

}
Ejemplo n.º 13
0
func (m *DebianCephInstallTemplate) Render(pkg urknall.Package) {
	host, _ := os.Hostname()
	ip := u.IP(m.phydev)
	osddir := u.ArraytoString("/", "/osd", m.osds)
	hostosd := u.ArraytoString(host+":/", "/osd", m.osds)
	CephUser := m.cephuser
	CephHome := m.cephhome

	pkg.AddCommands("cephinstall",
		u.Shell("echo deb https://download.ceph.com/debian-infernalis/ jessie main | tee /etc/apt/sources.list.d/ceph.list"),
		u.Shell("wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -"),
		u.InstallPackages("apt-transport-https  sudo"),
		u.UpdatePackagesOmitError(),
		u.InstallPackages("ceph-deploy ceph-common ceph-mds dnsmasq openssh-server ntp sshpass ceph ceph-mds ceph-deploy radosgw"),
	)

	pkg.AddCommands("cephuser_add",
		u.AddUser(CephUser, false),
	)

	pkg.AddCommands("cephuser_sudoer",
		u.Shell("echo '"+CephUser+" ALL = (root) NOPASSWD:ALL' && mkdir -p /etc/sudoers.d  | tee /etc/sudoers.d/"+CephUser+""),
	)

	pkg.AddCommands("chmod_sudoer",
		u.Shell("chmod 0440 /etc/sudoers.d/"+CephUser+""),
	)

	pkg.AddCommands("etchost",
		u.Shell("echo '"+ip+" "+host+"' >> /etc/hosts"),
	)

	pkg.AddCommands("ssh-keygen",
		u.Mkdir(CephHome+"/.ssh", CephUser, 0700),
		u.AsUser(CephUser, u.Shell("ssh-keygen -N '' -t rsa -f "+CephHome+"/.ssh/id_rsa")),
		u.AsUser(CephUser, u.Shell("cp "+CephHome+"/.ssh/id_rsa.pub "+CephHome+"/.ssh/authorized_keys")),
	)

	pkg.AddCommands("ssh_known_hosts",
		u.WriteFile(CephHome+"/.ssh/ssh_config", StrictHostKey, CephUser, 0755),
		u.WriteFile(CephHome+"/.ssh/config", fmt.Sprintf(SSHHostConfig, host, host, CephUser), CephUser, 0755),
	)

	pkg.AddCommands("mkdir_osd",
		u.Mkdir(osddir, "", 0755),
		u.Shell("sudo chown -R"+CephUser+":"+CephUser+" "+osddir),
	)

	pkg.AddCommands("write_cephconf",
		u.AsUser(CephUser, u.Shell("mkdir "+CephHome+"/ceph-cluster")),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster")),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy new "+host+" ")),
		u.AsUser(CephUser, u.Shell("echo 'osd crush chooseleaf type = 0' >> "+CephHome+"/ceph-cluster/ceph.conf")),
		u.AsUser(CephUser, u.Shell("echo 'osd_pool_default_size = 2' >> "+CephHome+"/ceph-cluster/ceph.conf")),
		u.AsUser(CephUser, u.Shell("echo 'mon_pg_warn_max_per_osd = 0' >> "+CephHome+"/ceph-cluster/ceph.conf")),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy install "+host+"")),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy mon create-initial | ceph-deploy mon create-initial")),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy osd prepare "+hostosd)),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy osd activate "+hostosd)),
		u.AsUser(CephUser, u.Shell("cd "+CephHome+"/ceph-cluster;ceph-deploy admin "+host+"")),
		u.AsUser(CephUser, u.Shell("chmod +r /etc/ceph/ceph.client.admin.keyring")),
		u.AsUser(CephUser, u.Shell("sleep 180")),
		u.AsUser(CephUser, u.Shell("ceph osd pool set rbd pg_num 150")),
		u.AsUser(CephUser, u.Shell("sleep 180")),
		u.AsUser(CephUser, u.Shell("ceph osd pool set rbd pgp_num 150")),
	)
	pkg.AddCommands("copy_keyring",
		u.Shell("cp "+CephHome+"/ceph-cluster/*.keyring /etc/ceph/"),
	)
}
Ejemplo n.º 14
0
func (m *DebianCephDatastoreTemplate) Render(pkg urknall.Package) {
	Uid := uuid.NewUUID()
	pkg.AddCommands("cephdatastore",
		u.AsUser(Ceph_User, u.Shell("ceph osd pool create "+Poolname+" 150")),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;ceph auth get-or-create client.libvirt mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool="+Poolname+"'"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;ceph auth get-key client.libvirt | tee client.libvirt.key"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;ceph auth get client.libvirt -o ceph.client.libvirt.keyring"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;cp ceph.client.* /etc/ceph"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster; "+fmt.Sprintf(Echo, Uid)+" >uid"),
		u.Shell("echo '*****************************************' "),
		u.Shell(fmt.Sprintf(Echo, Uid)),
		u.Shell("echo '*****************************************' "),
		u.WriteFile(UserHomePrefix+Ceph_User+"/ceph-cluster"+"/secret.xml", fmt.Sprintf(Xml, Uid), "root", 644),
		u.InstallPackages("libvirt-bin"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;sudo virsh secret-define secret.xml"),
		u.Shell("cd "+UserHomePrefix+Ceph_User+"/ceph-cluster;"+fmt.Sprintf(Setval, Uid)),
	)

}
Ejemplo n.º 15
0
func (m *DebianCephRemoveTemplate) Render(pkg urknall.Package) {
	host, _ := os.Hostname()

	CephUser := m.cephuser
	pkg.AddCommands("cache-clean",
		u.Shell("rm -r /var/lib/urknall/ceph*"),
	)
	pkg.AddCommands("purgedata",
		u.AsUser(CephUser, u.Shell("ceph-deploy purgedata "+host+"")),
	)
	pkg.AddCommands("forgetKeys",
		u.AsUser(CephUser, u.Shell("ceph-deploy forgetkeys")),
	)
	pkg.AddCommands("purge",
		u.AsUser(CephUser, u.Shell("ceph-deploy purge "+host+"")),
	)
	pkg.AddCommands("rm-sshkey",
		u.AsUser(CephUser, u.Shell("rm -r ~/.ssh")),
	)
	pkg.AddCommands("remove",
		u.Shell("rm -r /var/lib/ceph/"),
		u.Shell("rm -r "+CephUser+"/ceph-cluster"),
		u.Shell("apt-get -y remove ceph-deploy ceph-common ceph-mds"),
		u.Shell("apt-get -y purge ceph-deploy ceph-common ceph-mds"),
		u.Shell("apt-get -y autoremove"),
		u.Shell("rm -r /run/ceph"),
		u.Shell("rm /var/log/upstart/ceph*"),
	)

}
Ejemplo n.º 16
0
func (m *DebianCephGatewayTemplate) Render(pkg urknall.Package) {
	host, _ := os.Hostname()
	pkg.AddCommands("apache2",
		u.UpdatePackagesOmitError(),
		u.InstallPackages("apache2 libapache2-mod-fastcgi"),
		u.Shell("echo 'ServerName "+host+"' >>/etc/apache2/apache2.conf"),
		u.Shell("sudo a2enmod rewrite"),
		u.Shell("sudo a2enmod fastcgi"),
		u.Shell("service apache2 start"),
	)
	pkg.AddCommands("gateway-daemon",
		u.InstallPackages("radosgw"),
		u.Shell("ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring"),
		u.Shell("chmod +r /etc/ceph/ceph.client.radosgw.keyring"),
		u.Shell("ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.radosgw.admin --gen-key"),
		u.Shell("ceph-authtool -n client.radosgw.admin --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring"),
		u.Shell("ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.admin -i /etc/ceph/ceph.client.radosgw.keyring"),
	)
	/*	pkg.AddCommands("copy_keyring",
		u.Shell("sudo scp /etc/ceph/ceph.client.radosgw.keyring  "+ USERNAME+"@"+GATEWAY_IP+":/home/ceph"),
		u.Shell("ssh "+ USERNAME+"@"+GATEWAY_IP+" 'sudo mv ceph.client.radosgw.keyring /etc/ceph/ceph.client.radosgw.keyring'"),
	)*/
	pkg.AddCommands("create-osd-pools",
		u.Shell("ceph osd pool create .rgw.buckets 16 16"),
		u.Shell("ceph osd pool create .rgw 16 16"),
		u.Shell("ceph osd pool create .rgw.root 16 16"),
		u.Shell("ceph osd pool create .rgw.control 16 16"),
		u.Shell("ceph osd pool create .rgw.gc 16 16"),
		u.Shell("ceph osd pool create .rgw..buckets.index 16 16"),
		u.Shell("ceph osd pool create .log 16 16"),
		u.Shell("ceph osd pool create .intent-log 16 16"),
		u.Shell("ceph osd pool create .usage 16 16"),
		u.Shell("ceph osd pool create .users 16 16"),
		u.Shell("ceph osd pool create .users.email 16 16"),
		u.Shell("ceph osd pool create .users.swift 16 16"),
		u.Shell("ceph osd pool create .users.uid 16 16"),
		u.Shell("rados lspools"),
	)
	pkg.AddCommands("ceph-conf",
		u.Shell("cat >> /etc/ceph/ceph.conf <<'EOF' "+fmt.Sprintf(Ceph_conf, host)+"EOF"),
		u.Shell("ceph-deploy --overwrite-conf config pull "+host),
		u.Shell("ceph-deploy --overwrite-conf config push "+host),
	)
	/*	pkg.AddCommands("copy_keyring",
		u.Shell("sudo scp /etc/ceph/ceph.client.admin.keyring  "+ USERNAME+"@"+GATEWAY_IP+":/home/"+USERNAME),
		u.Shell("ssh "+ USERNAME+"@"+GATEWAY_IP+" 'sudo mv ceph.client.admin.keyring /etc/ceph/ceph.client.admin.keyring'"),
	)*/
	pkg.AddCommands("Cgi-wrapper",
		u.WriteFile("/var/www/html/s3gw.fcgi", S3gw, "root", 0755),
		u.Mkdir("/var/lib/ceph/radosgw/ceph-radosgw.admin", "", 0755),
		u.Shell("sudo /etc/init.d/radosgw start"),
		u.WriteFile("/etc/apache2/sites-available/rgw.conf", Rgw_conf, "root", 0644),
		u.Shell("sudo a2dissite 000-default"),
		u.Shell("sudo a2ensite rgw.conf"),
		u.Shell("sudo service apache2 restart"),
	)
}
Ejemplo n.º 17
0
func (m *DebianOneInstallTemplate) Render(pkg urknall.Package) {

	ip := u.IP("")

	pkg.AddCommands("repository",
		u.Shell("wget -q -O- http://downloads.opennebula.org/repo/Debian/repo.key | apt-key add -"),
		u.Shell("echo 'deb http://downloads.opennebula.org/repo/4.14/Debian/8 stable opennebula' > /etc/apt/sources.list.d/opennebula.list"),
		u.UpdatePackagesOmitError(),
	)

	pkg.AddCommands("one-install",
		u.InstallPackages("build-essential autoconf libtool make lvm2 ssh iproute iputils-arping opennebula opennebula-sunstone ntp ruby-dev"),
	)

	pkg.AddCommands("requires",
		u.Shell("echo 'oneadmin ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/oneadmin"),
		u.Shell(" chmod 0440 /etc/sudoers.d/oneadmin"),
		u.Shell(" rm /usr/share/one/install_gems"),
		u.Shell(" cp /usr/share/megam/megdc/conf/install_gems /usr/share/one/install_gems"),
		u.Shell(" chmod 755 /usr/share/one/install_gems"),
		u.Shell("/usr/share/one/install_gems sunstone"),
		u.Shell("sed -i 's/^[ \t]*:host:.*/:host: "+ip+"/' /etc/one/sunstone-server.conf"),
		u.AsUser("oneadmin", u.Shell("echo 'TM_MAD=ssh' >/tmp/ds_tm_mad")),
		u.AsUser("oneadmin", u.Shell("onedatastore update 0 /tmp/ds_tm_mad")),
		u.AsUser("oneadmin", u.Shell("onedatastore update 1 /tmp/ds_tm_mad")),
		u.AsUser("oneadmin", u.Shell("onedatastore update 2 /tmp/ds_tm_mad")),

		u.Shell("sunstone-server start"),
		u.Shell("econe-server start"),
		u.AsUser("oneadmin", u.Shell("one restart")),
		u.Shell("service opennebula restart"),
	)
}