Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
ssm committed Jan 21, 2020
1 parent fe8cdd1 commit 3514429
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 74 deletions.
6 changes: 3 additions & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file can be used to install module dependencies for unit testing
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
archive: "puppet/archive"
stdlib: "puppetlabs/stdlib"
systemd: "camptocamp/systemd"
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

All notable changes to this project will be documented in this file.

## Release 0.1.0
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

**Features**

**Bugfixes**

**Known Issues**
## [0.1.0] - 2020-01-21
### Added
- Initial release.
- Download, install and start Apache NiFi Toolkit.
90 changes: 42 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# nifi_toolkit

Welcome to your new module. A short overview of the generated parts can be found in the PDK documentation at https://puppet.com/pdk/latest/pdk_generating_modules.html .

The README template below provides a starting point with details about what information to include in your README.

#### Table of Contents

1. [Description](#description)
Expand All @@ -17,71 +13,69 @@ The README template below provides a starting point with details about what info

## Description

Briefly tell users why they might want to use your module. Explain what your module does and what kind of problems users can solve with it.

This should be a fairly short description helps the user decide if your module is what they want.
Install and configure the [Apache NiFi
Toolkit](https://nifi.apache.org/), a CLI for the Apache NiFi dataflow
automation software.

## Setup

### What nifi_toolkit affects **OPTIONAL**
### What nifi_toolkit affects

If it's obvious what your module touches, you can skip this section. For example, folks can probably figure out that your mysql_instance module affects their MySQL instances.
This module will download the Apache Toolkit NiFi tarball to
`/var/tmp/`.

If there's more that they should know about, though, this is the place to mention:
The tarball will be unpacked to `/opt/nifi-toolkit` by default.

* Files, packages, services, or operations that the module will alter, impact, or execute.
* Dependencies that your module automatically installs.
* Warnings or other important notices.
### Setup Requirements

### Setup Requirements **OPTIONAL**
NiFi requires Java Runtime Environment. Nifi 1.10.1 runs on Java 8 or
Java 11.

If your module requires anything extra before setting up (pluginsync enabled, another module, etc.), mention it here.

If your most recent release breaks compatibility or requires particular steps for upgrading, you might want to include an additional "Upgrading" section here.
When installing on local infrastructure, consider download the
distribution tarballs, validate them with the Apache distribution
keys, and store it on a local repository. Adjust the configuration
variables to point to your local repository. The [NiFi download
page](https://nifi.apache.org/download.html) also documents how to
verify the integrity and authenticity of the downloaded files.

### Beginning with nifi_toolkit

The very basic steps needed for a user to get the module up and running. This can include setup steps, if necessary, or it can be an example of the most basic use of the module.

## Usage

Include usage examples for common use cases in the **Usage** section. Show your users how to use your module to solve problems, and be sure to include code examples. Include three to five examples of the most important or common tasks a user can accomplish with your module. Show users how to accomplish more complex tasks that involve different types, classes, and functions working in tandem.

## Reference

This section is deprecated. Instead, add reference information to your code as Puppet Strings comments, and then use Strings to generate a REFERENCE.md in your module. For details on how to add code comments and generate documentation with Strings, see the Puppet Strings [documentation](https://puppet.com/docs/puppet/latest/puppet_strings.html) and [style guide](https://puppet.com/docs/puppet/latest/puppet_strings_style.html)
Add dependency modules to your puppet environment:

If you aren't ready to use Strings yet, manually create a REFERENCE.md in the root of your module directory and list out each of your module's classes, defined types, facts, functions, Puppet tasks, task plans, and resource types and providers, along with the parameters for each.
- puppet/archive
- puppetlabs/stdlib
- camptocamp/systemd

For each element (class, defined type, function, and so on), list:

* The data type, if applicable.
* A description of what the element does.
* Valid values, if the data type doesn't make it obvious.
* Default value, if any.
## Usage

For example:
To download and install NiFi Toolkit, include the module. This will
download nifi toolkit and unpack it under
`/opt/nifi-toolkit/nifi-toolkit-<version>`.

```puppet
include nifi_toolkit
```
### `pet::cat`
#### Parameters
##### `meow`
Enables vocalization in your cat. Valid options: 'string'.
To host the file locally, add a nifi_toolkit::download_url variable for the
module.

Default: 'medium-loud'.
```yaml
nifi_toolkit::download_url: "http://repo.local/nifi/1.10.0/nifi-toolkit-1.10.0-bin.tar.gz"
```
## Limitations
Please keep `nifi_toolkit::download_url`,
`nifi_toolkit::download_checksum` and `nifi_toolkit::version` in sync.
The URL, checksum and version should match. Otherwise, Puppet will
become confused.

In the Limitations section, list any incompatibilities, known issues, or other warnings.
## Limitations

## Development
This module is under development, and therefore somewhat light on
functionality.

In the Development section, tell other users the ground rules for contributing to your project and how they should submit their work.
Configuration and repository directories are not managed yet. These
can be managed outside the module with `file` resources.

## Release Notes/Contributors/Etc. **Optional**
## Development

If you aren't using changelog, put your release notes here (though you should consider using changelog). You can also add any additional sections you feel are necessary or important to include here. Please use the `## ` header.
In the Development section, tell other users the ground rules for
contributing to your project and how they should submit their work.
86 changes: 86 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Reference
<!-- DO NOT EDIT: This document was generated by Puppet Strings -->

## Table of Contents

**Classes**

* [`nifi_toolkit`](#nifi_toolkit): Install Apache NiFi Toolkit

## Classes

### nifi_toolkit

Install Apache NiFi Toolkit

#### Examples

##### Defaults

```puppet
include nifi_toolkit
```

##### Downloading from a different repository

```puppet
class { 'nifi_toolkit':
download_url => 'https://repo.local/nifi/nifi-toolkit-1.10.0.tar.gz',
}
```

#### Parameters

The following parameters are available in the `nifi_toolkit` class.

##### `version`

Data type: `String`

The version of Apache NiFi Toolkit. This must match the version in
the tarball.

Default value: '1.10.0'

##### `download_url`

Data type: `String`

Where to download the binary installation tarball from.

Default value: 'http://mirrors.ibiblio.org/apache/nifi/1.10.0/nifi-toolkit-1.10.0-bin.tar.gz'

##### `download_checksum`

Data type: `String`

The expected checksum of the downloaded tarball. This is used for
verifying the integrity of the downloaded tarball.

Default value: 'cdea77679a6b6198a60f5b89d6d97783398b48b8d02b513b081f2456f8949ad5'

##### `download_checksum_type`

Data type: `String`

The checksum type of the downloaded tarball. This is used for
verifying the integrity of the downloaded tarball.

Default value: 'sha256'

##### `install_root`

Data type: `Stdlib::Absolutepath`

The root directory of the nifi toolkit installation.

Default value: '/opt/nifi-toolkit'

##### `download_tmp_dir`

Data type: `Stdlib::Absolutepath`



Default value: '/var/tmp'

67 changes: 67 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# @summary Install Apache NiFi Toolkit
#
# Install Apache NiFi Toolkit
#
# @param version
# The version of Apache NiFi Toolkit. This must match the version in
# the tarball.
#
# @param download_url
# Where to download the binary installation tarball from.
#
# @param download_checksum
# The expected checksum of the downloaded tarball. This is used for
# verifying the integrity of the downloaded tarball.
#
# @param download_checksum_type
# The checksum type of the downloaded tarball. This is used for
# verifying the integrity of the downloaded tarball.
#
# @param install_root
# The root directory of the nifi toolkit installation.
#
# @example Defaults
# include nifi_toolkit
#
# @example Downloading from a different repository
# class { 'nifi_toolkit':
# download_url => 'https://repo.local/nifi/nifi-toolkit-1.10.0.tar.gz',
# }
#
class nifi_toolkit (
String $version = '1.10.0',
String $download_url = 'http://mirrors.ibiblio.org/apache/nifi/1.10.0/nifi-toolkit-1.10.0-bin.tar.gz',
String $download_checksum = 'cdea77679a6b6198a60f5b89d6d97783398b48b8d02b513b081f2456f8949ad5',
String $download_checksum_type = 'sha256',
Stdlib::Absolutepath $download_tmp_dir = '/var/tmp',
Stdlib::Absolutepath $install_root = '/opt/nifi-toolkit',
) {

$local_tarball = "${download_tmp_dir}/nifi-toolkit-${version}.tar.gz"
$software_directory = "${install_root}/nifi-toolkit-${version}"
$cli = "${software_directory}/bin/cli.sh"

archive { $local_tarball:
source => $download_url,
checksum => $download_checksum,
checksum_type => $download_checksum_type,
extract => true,
extract_path => $install_root,
creates => $software_directory,
cleanup => true,
}

file { $install_root:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}

exec { "permissions for ${software_directory}":
path => ['/usr/bin'],
command => "chown -Rh root: ${software_directory}",
refreshonly => true,
subscribe => Archive[$local_tarball],
}
}
24 changes: 7 additions & 17 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,31 @@
"name": "ssm-nifi_toolkit",
"version": "0.1.0",
"author": "ssm",
"summary": "",
"summary": "Install Apache NiFi Toolkit",
"license": "Apache-2.0",
"source": "",
"source": "https://github.com/ssm/ssm-nifi_toolkit.git",
"project_page": "https://github.com/ssm/ssm-nifi_toolkit",
"issues_url": "https://github.com/ssm/ssm-nifi_toolkit/issues",
"dependencies": [

],
"operatingsystem_support": [
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"7"
"7", "8"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"8"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"7"
"7", "8"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"9"
"9", "10"
]
},
{
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/nifi_toolkit_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe 'nifi_toolkit' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end

0 comments on commit 3514429

Please sign in to comment.