Skip to content

Instantly share code, notes, and snippets.

@chirauki
Last active August 29, 2015 14:00
Show Gist options
  • Save chirauki/11403857 to your computer and use it in GitHub Desktop.
Save chirauki/11403857 to your computer and use it in GitHub Desktop.
Abiquo installation on a CentOS 6 from mothership
#!/bin/bash
if [ -f /usr/bin/puppet ]
then
echo "Puppet agent already installed. Skipping install"
else
yum -y localinstall http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum -y install puppet
[ -d /etc/puppet/modules ] || mkdir -p /etc/puppet/modules
cd /etc/puppet/modules && curl -L -s --insecure https://github.com/chirauki/abiquo-abiquo/blob/master/pkg/abiquo-abiquo-0.1.0.tar.gz?raw=true -o abiquo-abiquo-0.1.0.tar.gz
mkdir -p /etc/puppet/modules/abiquo && cd /etc/puppet/modules/abiquo && tar --strip-components=1 -xzf ../abiquo-abiquo-0.1.0.tar.gz
cd /etc/puppet/modules/ && rm *.tar.gz
for i in `grep dependency /etc/puppet/modules/abiquo/Modulefile | cut -d"'" -f2`; do [ -d /etc/puppet/modules/`echo $i | cut -d'/' -f2` ] || puppet module install $i ; done
# JCE download
# JCE 7
mkdir -p /etc/puppet/modules/abiquo/files/jce/7/
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jce/7/UnlimitedJCEPolicyJDK7.zip \
-O /tmp/JCE.zip && cd /tmp && unzip JCE.zip && \
mv -f /tmp/UnlimitedJCEPolicy/*.jar /etc/puppet/modules/abiquo/files/jce/7/
# JCE 8
mkdir -p /etc/puppet/modules/abiquo/files/jce/8/
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip \
-O /tmp/JCE.zip && cd /tmp && unzip JCE.zip && \
mv -f /tmp/UnlimitedJCEPolicyJDK8/*.jar /etc/puppet/modules/abiquo/files/jce/8/
fi
cat << EOF > ~/abi.pp
class { 'abiquo':
abiquo_version => '3.2',
upgrade_packages => false,
require => Mount['/opt/vm_repository'],
}
class { 'abiquo::api':
secure => true
}
class { 'abiquo::client':
secure => true
}
class { 'abiquo::remoteservice':
rstype => 'datacenter'
}
class { 'abiquo::v2v': }
abiquo::property{ 'abiquo.appliancemanager.repositoryLocation':
value => '10.60.1.72:/opt/vm_repository',
section => 'remote-services',
}
abiquo::property{ 'am.conversions.skip':
value => true,
section => 'remote-services',
}
file { "/opt/vm_repository":
ensure => 'directory'
}
mount { "/opt/vm_repository":
device => "10.60.1.72:/opt/vm_repository",
fstype => "nfs",
ensure => "mounted",
options => "defaults",
atboot => true,
require => File['/opt/vm_repository'],
}
EOF
puppet apply ~/abi.pp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment