Skip to content

Instantly share code, notes, and snippets.

@dcapwell
Last active December 30, 2015 02:09
Show Gist options
  • Save dcapwell/7760625 to your computer and use it in GitHub Desktop.
Save dcapwell/7760625 to your computer and use it in GitHub Desktop.
centos64-2 : Error: Could not apply complete catalog: Found 1 dependency cycle:
centos64-2 : (Exec[wget zookeeper-3.4.5.tar.gz] => Exec[zookeeper_untar] => File[zookeeper-reown-build] => File[/opt/apache/zookeeper/zookeeper-current] => Class[Zookeeper::Setup_envo] => Class[Zookeeper::Install] => Exec[wget zookeeper-3.4.5.tar.gz])
centos64-2 : Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
class zookeeper(
$user,
$group,
$log_path,
$zookeeper_datastore_log,
$zookeeper_datastore,
$zookeeper_myid,
# $zookeeper_parent_dir,
# $zookeeper_home,
$zookeeper_version,
$zookeeper_log_dir
) {
$zookeeper_parent_dir = "/opt/apache/zookeeper"
$zookeeper_home = "${zookeeper_parent_dir}/zookeeper-current"
class { "zookeeper::setup_envo": }
class { "zookeeper::install":
require => Class["zookeeper::setup_envo"]
}
class { "zookeeper::config":
require => Class["zookeeper::install"]
}
}
# Responsible for setting up the environment needed for zookeeper
# This includes creating users, directories, etc.
class zookeeper::setup_envo {
# create users/groups
group { "$zookeeper::group":
ensure => present
}
user { "$zookeeper::user":
ensure => present,
comment => "User that will run and manage zookeeper",
groups => ["$zookeeper::group"],
require => Group["$zookeeper::group"]
}
# create directories
## puppet doesn't have a notion of 'mkdir -p', so its ether a) hard-code the value here, b) break out into ruby dsl, c) create my own 'mkdir -p' type
# file { "${zookeeper::zookeeper_parent_dir}":
# path => "${zookeeper::zookeeper_parent_dir}",
# owner => $zookeeper::user,
# group => $zookeeper::group,
# require => User["$zookeeper::user"],
# mode => 644,
# ensure => directory,
# recurse => true,
# backup => false
# }
## /opt should already exist
file { ["/opt/apache", "/opt/apache/zookeeper"]:
owner => $zookeeper::user,
group => $zookeeper::group,
require => User["$zookeeper::user"],
mode => 644,
ensure => directory,
recurse => true,
backup => false
}
file { "/opt/apache/zookeeper/zookeeper-current":
target => "${zookeeper::zookeeper_parent_dir}/zookeeper-${zookeeper::zookeeper_version}",
ensure => symlink,
require => File["/opt/apache/zookeeper"],
owner => $zookeeper::user,
group => $zookeeper::group,
backup => false,
}
file { "zookeeper_log_folder":
path => $zookeeper::log_path,
owner => $zookeeper::user,
group => $zookeeper::group,
require => User["$zookeeper::user"],
mode => 644,
ensure => directory,
backup => false,
}
file { "zookeeper_datastore":
path => "${zookeeper::zookeeper_datastore}",
ensure => directory,
owner => $zookeeper::user,
group => $zookeeper::group,
require => User["$zookeeper::user"],
mode => 644,
backup => false,
}
file { "zookeeper_datastore_log":
path => "$zookeeper::zookeeper_datastore_log",
ensure => directory,
owner => $zookeeper::user,
group => $zookeeper::group,
require => User["$zookeeper::user"],
mode => 644,
backup => false,
}
}
# Responsible for installing (but not configuring) zookeeper
# assumes zookeeper::setup_env runs first
class zookeeper::install {
exec { "wget zookeeper-${zookeeper::zookeeper_version}.tar.gz":
command => "/usr/bin/wget -O ${zookeeper::zookeeper_parent_dir}/zookeeper-${zookeeper::zookeeper_version}.tar.gz http://www.interior-dsgn.com/apache/zookeeper/zookeeper-${zookeeper::zookeeper_version}/zookeeper-${zookeeper::zookeeper_version}.tar.gz",
cwd => "${zookeeper::zookeeper_parent_dir}",
creates => "${zookeeper::zookeeper_parent_dir}/zookeeper-${zookeeper::zookeeper_version}.tar.gz",
}
exec { "zookeeper_untar":
command => "/bin/tar xzf zookeeper-${zookeeper::zookeeper_version}.tar.gz;",
cwd => "${zookeeper::zookeeper_parent_dir}",
require => Exec["wget zookeeper-${zookeeper::zookeeper_version}.tar.gz"],
creates => "${zookeeper::zookeeper_parent_dir}/zookeeper-${zookeeper::zookeeper_version}",
}
file { "zookeeper-reown-build":
path => "${zookeeper::zookeeper_parent_dir}/zookeeper-${zookeeper::zookeeper_version}",
recurse => true,
owner => $zookeeper::user,
group => $zookeeper::group,
require => Exec["zookeeper_untar"],
backup => false,
}
}
# Responsible for configuring zookeeper
# assumes zookeeper::install and zookeeper::setup_env are ran first
class zookeeper::config {
file { "zookeeper_datastore_myid":
path => "${zookeeper::zookeeper_datastore}/myid",
ensure => file,
content => template("zookeeper/conf/${environment}/myid.erb"),
owner => $zookeeper::user,
group => $zookeeper::group,
mode => 644,
backup => false,
}
file { "conf/zoo.cfg":
path => "${zookeeper::zookeeper_home}/conf/zoo.cfg",
owner => $zookeeper::user,
group => $zookeeper::group,
mode => 644,
content => template("zookeeper/conf/${environment}/zoo.cfg.erb"),
}
file { "zookeeper_java.env":
path => "${zookeeper::zookeeper_home}/conf/java.env",
owner => $zookeeper::user,
group => $zookeeper::group,
mode => 644,
content => template("zookeeper/conf/${environment}/java.env.erb"),
}
file { "zookeeper_log4j":
path => "${zookeeper::zookeeper_home}/conf/log4j.properties",
owner => $zookeeper::user,
group => $zookeeper::group,
mode => 644,
content => template("zookeeper/conf/${environment}/log4j.properties.erb"),
}
file { "zookeeper-server-service":
path => "/etc/init.d/zookeeper-server",
content => template("zookeeper/service/zookeeper-server.erb"),
ensure => file,
owner => "root",
group => "root",
mode => 755
}
file { "zookeeper-init-service":
path => "/etc/init.d/zookeeper",
content => template("zookeeper/service/zookeeper.erb"),
ensure => file,
owner => $zookeeper::user,
group => $zookeeper::group,
mode => 755
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment