Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppet modules changes for RHEL 7.4 support for ScaleIO #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 55 additions & 32 deletions manifests/mdm_server.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Configure ScaleIO Gateway service installation
include firewall

class scaleio::mdm_server (
$ensure = 'present', # present|absent - Install or remove MDM service
Expand All @@ -7,6 +8,8 @@
$mdm_ips = undef, # string - MDM IPs
$mdm_management_ips = undef, # string - MDM management IPs
$pkg_ftp = undef, # string - URL where packages are placed (for example: ftp://ftp.emc.com/Ubuntu/2.0.10000.2072)
$pkg_path = undef, # string - Location of RPMs located on the local server
$scaleio_password = undef, # string - ScaleIO Password
)
{
$provider = "${::osfamily}${::operatingsystemmajrelease}" ? {
Expand All @@ -25,48 +28,68 @@
proto => tcp,
action => accept,
}
scaleio::common_server { 'install common packages for MDM': } ->
scaleio::common_server { 'install common packages for MDM':
ensure_java => 'present'
} ->
package { ['mutt', 'python', 'python-paramiko']:
ensure => installed,
} ->
scaleio::package { 'mdm':
ensure => $ensure,
pkg_ftp => $pkg_ftp,
}
service { 'mdm':
ensure => 'running',
enable => true,
hasstatus => true,
require => Scaleio::Package['mdm'],
provider => $provider
pkg_path => $pkg_path
} ->
scaleio::package { 'lia':
ensure => $ensure,
pkg_ftp => $pkg_ftp,
pkg_path => $pkg_path,
scaleio_password => $scaleio_password
}

if $is_manager != undef {
file_line { 'mdm role':
path => '/opt/emc/scaleio/mdm/cfg/conf.txt',
line => "actor_role_is_manager=${is_manager}",
match => '^actor_role_is_manager',
require => Scaleio::Package['mdm'],
notify => Service['mdm'],
before => [Exec['create_cluster']],
if $package == 'mdm' {
service { 'mdm':
ensure => 'running',
enable => true,
hasstatus => true,
require => Scaleio::Package['mdm'],
provider => $provider
} ->
service { 'lia':
ensure => 'running',
enable => true,
hasstatus => true,
require => Scaleio::Package['mdm'],
provider => $provider
}
}

# Cluster creation is here
$opts = '--approve_certificate --accept_license --create_mdm_cluster --use_nonsecure_communication'
$master_opts = "--master_mdm_name ${master_mdm_name} --master_mdm_ip ${mdm_ips}"
$management_ip_opts = $mdm_management_ips ? {
undef => '',
default => "--master_mdm_management_ip ${mdm_management_ips}"
}
exec { 'create_cluster':
onlyif => "test -n '${master_mdm_name}'",
require => Service['mdm'],
# Sleep is needed here because service in role changing can be still alive and not restarted
command => "sleep 2 ; scli --query_cluster --approve_certificate || scli ${opts} ${master_opts} ${management_ip_opts}",
path => '/bin:/usr/bin',
tries => 5,
try_sleep => 5,
if $is_manager != undef {
file_line { 'mdm role':
path => '/opt/emc/scaleio/mdm/cfg/conf.txt',
provider => ruby,
line => "actor_role_is_manager=${is_manager}",
match => '^actor_role_is_manager',
require => Scaleio::Package['mdm'],
notify => Service['mdm'],
before => [Exec['create_cluster']],
}
}

# Cluster creation is here
$opts = '--approve_certificate --accept_license --create_mdm_cluster --use_nonsecure_communication'
$master_opts = "--master_mdm_name ${master_mdm_name} --master_mdm_ip ${mdm_ips}"
$management_ip_opts = $mdm_management_ips ? {
undef => '',
default => "--master_mdm_management_ip ${mdm_management_ips}"
}
exec { 'create_cluster':
onlyif => "test -n '${master_mdm_name}'",
require => Service['mdm'],
# Sleep is needed here because service in role changing can be still alive and not restarted
command => "sleep 2 ; scli --query_cluster --approve_certificate || scli ${opts} ${master_opts} ${management_ip_opts}",
path => '/bin:/usr/bin',
tries => 5,
try_sleep => 5,
}
}
}

Expand Down
35 changes: 35 additions & 0 deletions manifests/package.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
define scaleio::package (
$ensure = undef,
$pkg_ftp = undef,
$pkg_path = undef,
$scaleio_password = undef,
)
{
$package = $::osfamily ? {
Expand All @@ -11,6 +13,7 @@
'sdc' => 'EMC-ScaleIO-sdc',
'sds' => 'EMC-ScaleIO-sds',
'xcache' => 'EMC-ScaleIO-xcache',
'lia' => 'EMC-ScaleIO-lia',
},
'Debian' => $title ? {
'gateway' => 'emc-scaleio-gateway',
Expand All @@ -19,6 +22,7 @@
'sdc' => 'emc-scaleio-sdc',
'sds' => 'emc-scaleio-sds',
'xcache' => 'emc-scaleio-xcache',
'lia' => 'emc-scaleio-lia',
},
}

Expand Down Expand Up @@ -64,4 +68,35 @@
provider => $provider,
}
}
elsif $pkg_path and $pkg_path != '' {
$rel = $::operatingsystemmajrelease ? {
'' => $::operatingsystemrelease,
default => $::operatingsystemmajrelease
}
$version = $::osfamily ? {
'RedHat' => "RHEL${rel}",
'Debian' => "Ubuntu${rel}",
}
$provider = $::osfamily ? {
'RedHat' => 'rpm',
'Debian' => 'dpkg',
}
$pkg_ext = $::osfamily ? {
'RedHat' => 'rpm',
'Debian' => 'deb',
}
if $package == 'lia' {
exec {"$provider ${pkg_path}/$version/${package}*.${pkg_ext}":
environment => [ "TOKEN=${scaleio::password}" ],
tag => 'scaleio-install',
unless => "rpm -q 'EMC-ScaleIO-lia'",
}
} else {
package {$package:
provider => $provider,
source => "${pkg_path}/$version/${package}*.${pkg_ext}",
}
}

}
}