diff --git a/manifests/init.pp b/manifests/init.pp index 583d6a5..74bf04c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,28 +1,38 @@ -class confluent ( +class confluent ( $version = '3.0', + $scala_version = '2.11', $kafka = false, - $kafkastreams = false, $zookeeper = false, $schemaregistry = false, $restservice = false, ) { - if ! ($kafka or $kafkastreams or $zookeeper or $schemaregistry or $restservice) { + if ! ($kafka or $zookeeper or $schemaregistry or $restservice) { fail('You must choose to install at least one component') } - if $kafka { - include ::confluent::kafka - } + # Kafka and zookeeper are in same package - if $kafkastreams { - include ::confluent::kafkastreams - } + if ($kafka or $zookeeper) { + + $packages = [ "confluent-kafka-${::confluent::scala_version}" ] + + package { $packages: + ensure => installed, + } + + if $kafka { + include ::confluent::kafka + } + + if $zookeeper { + include ::confluent::zookeeper + } - if $zookeeper { - include ::confluent::zookeeper } + #Separate components + if $schemaregistry { include ::confluent::schemaregistry } diff --git a/manifests/kafka.pp b/manifests/kafka.pp index 493b1b5..fcd8f20 100644 --- a/manifests/kafka.pp +++ b/manifests/kafka.pp @@ -1 +1,7 @@ -class confluent::kafka { } +class confluent::kafka { + + class { '::confluent::kafka::config': } -> + class { '::confluent::kafka::service': } + + +} diff --git a/manifests/kafka/install.pp b/manifests/kafka/install.pp deleted file mode 100644 index 5198502..0000000 --- a/manifests/kafka/install.pp +++ /dev/null @@ -1 +0,0 @@ -class confluent::kafka::install { } diff --git a/manifests/kafka/service.pp b/manifests/kafka/service.pp index 7d7dd3b..642eb1a 100644 --- a/manifests/kafka/service.pp +++ b/manifests/kafka/service.pp @@ -1 +1,14 @@ -class confluent::kafka::service { } +class confluent::kafka::service { + + file { '/etc/init.d/kafka': + ensure => file, + mode => '0755', + } + + service { 'kafka': + ensure => running, + enable => true, + require => File['/etc/init.d/kafka'], + } + +} diff --git a/manifests/kafkastreams/install.pp b/manifests/kafkastreams/install.pp deleted file mode 100644 index 35be3f8..0000000 --- a/manifests/kafkastreams/install.pp +++ /dev/null @@ -1 +0,0 @@ -class confluent::kafkastreams::install { } diff --git a/manifests/restservice/install.pp b/manifests/restservice/install.pp index 8d47c86..3869af4 100644 --- a/manifests/restservice/install.pp +++ b/manifests/restservice/install.pp @@ -1 +1,7 @@ -class confluent::restservice::install { } +class confluent::restservice::install { + + package { 'confluent-kafka-rest': + ensure => installed, + } + +} diff --git a/manifests/restservice/service.pp b/manifests/restservice/service.pp index 64ef3da..07755a8 100644 --- a/manifests/restservice/service.pp +++ b/manifests/restservice/service.pp @@ -1 +1,14 @@ -class confluent::restservice::service { } +class confluent::restservice::service { + + file { '/etc/init.d/kafka-restservice': + ensure => file, + mode => '0755', + } + + service { 'kafka-restservice': + ensure => running, + enable => true, + require => File['/etc/init.d/kafka-restservice'], + } + +} diff --git a/manifests/schemaregistry/install.pp b/manifests/schemaregistry/install.pp index ef2459a..e418ad9 100644 --- a/manifests/schemaregistry/install.pp +++ b/manifests/schemaregistry/install.pp @@ -1 +1,7 @@ -class confluent::schemaregistry::install { } +class confluent::schemaregistry::install { + + package { 'confluent-schema-registry': + ensure => installed, + } + +} diff --git a/manifests/schemaregistry/service.pp b/manifests/schemaregistry/service.pp index 4436244..c42dc2a 100644 --- a/manifests/schemaregistry/service.pp +++ b/manifests/schemaregistry/service.pp @@ -1 +1,14 @@ -class confluent::schemaregistry::service { } +class confluent::schemaregistry::service { + + file { '/etc/init.d/kafka-schemaregistry': + ensure => file, + mode => '0755', + } + + service { 'kafka-schemaregistry': + ensure => running, + enable => true, + require => File['/etc/init.d/kafka-schemaregistry'], + } + +} diff --git a/manifests/zookeeper.pp b/manifests/zookeeper.pp index fe83a47..2ca84d1 100644 --- a/manifests/zookeeper.pp +++ b/manifests/zookeeper.pp @@ -1 +1,6 @@ -class confluent::zookeeper { } +class confluent::zookeeper { + + class { '::confluent::zookeeper::config': } -> + class { '::confluent::zookeeper::service': } + +} diff --git a/manifests/zookeeper/install.pp b/manifests/zookeeper/install.pp deleted file mode 100644 index b2f56ce..0000000 --- a/manifests/zookeeper/install.pp +++ /dev/null @@ -1 +0,0 @@ -class confluent::zookeeper::install { } diff --git a/manifests/zookeeper/service.pp b/manifests/zookeeper/service.pp index adc7e4c..e9f418b 100644 --- a/manifests/zookeeper/service.pp +++ b/manifests/zookeeper/service.pp @@ -1 +1,14 @@ -class confluent::zookeeper::service { } +class confluent::zookeeper::service { + + file { '/etc/init.d/zookeeper': + ensure => file, + mode => '0755', + } + + service { 'zoookeeper': + ensure => running, + enable => true, + require => File['/etc/init.d/zookeeper'], + } + +}