Add support for CentOS.

- Install openjdk 1.8.0 headless.
- Manage the /boot that is mounted as RAID 1 on all available disks.

Change-Id: Ie346a466132d0dabc2eda61d4ac65ebd50b78222
This commit is contained in:
Guillaume Thouvenin 2015-03-05 11:06:41 +01:00
parent 7017a809fd
commit 5e878fba1b
6 changed files with 114 additions and 19 deletions

View File

@ -3,7 +3,12 @@ $fuel_settings = parseyaml(file('/etc/astute.yaml'))
# Params related to Elasticsearch.
$es_dir = $fuel_settings['elasticsearch_kibana']['data_dir']
$es_instance = "es-01"
$java = "openjdk-7-jre-headless"
# Java
$java = $::operatingsystem ? {
CentOS => "java-1.8.0-openjdk-headless",
Ubuntu => "openjdk-7-jre-headless"
}
# Ensure that java is installed
package { $java:

View File

@ -0,0 +1,39 @@
#!/bin/bash
# Use this script if you want to allocate a new partition that is already used
# in RAID. It is the case for example with the current deployment of CentOS.
# $1 is the disk (for example: /dev/sdc)
# $2 is the raid : default is "/dev/md0"
set -eux
DISK=$1
RAID=${2:-/dev/md0}
MDADM=$(which mdadm 2>/dev/null)
PARTED=$(which parted 2>/dev/null)
PARTPROBE=$(which partprobe 2>/dev/null)
function add_new_partition {
FREESPACE=$(${PARTED} "$1" unit s p free | grep "Free Space" | awk '{print $1, $2}')
if [[ -z "${FREESPACE}" ]]
then
echo "Failed to find free space"
exit 1
fi
${PARTED} -s -- $1 unit s mkpart primary ${FREESPACE} &> /dev/null
}
# Get the partition involved into RAID.
PARTITION=$(${MDADM} -D ${RAID} | grep "active" | grep ${DISK} | awk '{print $7}')
# Remove the partition from RAID.
$MDADM $RAID --fail $PARTITION --remove $PARTITION &>/dev/null
# Create a new partition
add_new_partition $DISK
# Add the partition that belongs to the raid.
$MDADM --add $RAID $PARTITION

View File

@ -33,11 +33,18 @@ class disk_management (
$vg_name,
) {
# CentOS is deployed with a /boot in RAID 1. We create a new partition with
# an ID 4. Until we improve this we need to deal with it.
$usedisks = $::operatingsystem ? {
CentOS => regsubst($disks, '/dev/([a-z]+)', '/dev/\14', 'G'),
Ubuntu => $disks
}
disk_management::partition { $disks:
}
disk_management::lvm_fs { $directory:
disks => $disks,
disks => $usedisks,
lv_name => $lv_name,
vg_name => $vg_name,
require => Disk_management::Partition[$disks],

View File

@ -1 +1,32 @@
define disk_management::partition {}
define disk_management::partition {
$disk = $title
$script = "/usr/local/bin/add_partition_on_raid.sh"
$cmd = "${script} ${disk}"
case $::osfamily {
'RedHat': {
# CentOS deploys /boot into a RAID on all available disks. So in
# this case we need to create a new partition instead of using the whole
# disks as we do for Debian family.
package { 'parted':
ensure => installed,
}
file { $script:
ensure => 'file',
source => 'puppet:///modules/disk_management/add_partition_on_raid.sh',
owner => 'root',
group => 'root',
mode => '0700',
require => Package['parted'],
}
exec { 'run_script':
command => $cmd,
require => File[$script],
}
}
}
}

View File

@ -16,11 +16,11 @@ releases:
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
# - os: centos
# version: 2014.2-6.1
# mode: ['ha', 'multinode']
# deployment_scripts_path: deployment_scripts/
# repository_path: repositories/centos
- os: centos
version: 2014.2-6.1
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
# Version of plugin package
package_version: '1.0.0'

View File

@ -19,20 +19,33 @@ FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_
# Kibana 3 sources
KIBANA_TARBALL_URL="https://download.elasticsearch.org/kibana/kibana/kibana-3.1.2.tar.gz"
# Downloads needed DEB
function deb_download {
FILE=$(basename $1)
wget -qO - $1 > ${DEB_REPO}/$FILE
# Downloads needed RPM or DEB packages
function download {
case "$1" in
deb) REPO=$DEB_REPO;;
rpm) REPO=$RPM_REPO;;
esac
shift
while [ $# -gt 0 ]; do
FILE=$(basename $1)
wget -qO - $1 > $REPO/$FILE
shift
done
}
# Packages needed to install JRE headless
deb_download http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata_2015a-0ubuntu0.12.04_all.deb
deb_download http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata-java_2015a-0ubuntu0.12.04_all.deb
deb_download http://mirrors.kernel.org/ubuntu/pool/main/p/pcsc-lite/libpcsclite1_1.7.4-2ubuntu2_amd64.deb
deb_download http://mirrors.kernel.org/ubuntu/pool/main/c/ca-certificates-java/ca-certificates-java_20110912ubuntu6_all.deb
deb_download http://mirrors.kernel.org/ubuntu/pool/main/j/java-common/java-common_0.43ubuntu2_all.deb
deb_download http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-7/openjdk-7-jre-headless_7u75-2.5.4-1~precise1_amd64.deb
deb_download https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.deb
download deb http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata_2015a-0ubuntu0.12.04_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata-java_2015a-0ubuntu0.12.04_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/p/pcsc-lite/libpcsclite1_1.7.4-2ubuntu2_amd64.deb \
http://mirrors.kernel.org/ubuntu/pool/main/c/ca-certificates-java/ca-certificates-java_20110912ubuntu6_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/j/java-common/java-common_0.43ubuntu2_all.deb \
http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-7/openjdk-7-jre-headless_7u75-2.5.4-1~precise1_amd64.deb \
https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.deb
# For redhat only java 1.8 headless is needed
download rpm http://mirror.centos.org/centos/6/updates/x86_64/Packages/java-1.8.0-openjdk-headless-1.8.0.31-1.b13.el6_6.x86_64.rpm \
https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.noarch.rpm
# Install puppet manifests
# Clean-up first