Skip to content
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
1 change: 1 addition & 0 deletions data/RedHat-family.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 7 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nimsoft::hub_port: 48002
nimsoft::package_name: 'nimsoft-robot'
nimsoft::package_ensure: 'present'
nimsoft::service_name: 'nimbus'
nimsoft::service_ensure: running
nimsoft::service_enable: true
nimsoft::config_file: '/opt/nms-robot-vars.cfg'
12 changes: 12 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 5
defaults:
datadir: data
data_hash: yaml_data

hierarchy:
- name: 'Operating System Family'
path: '%{facts.os.family}-family.yaml'

- name: 'common'
path: 'common.yaml'
86 changes: 86 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Class: nimsoft
# ===========================
#
# Full description of class nimsoft here.
#
# Parameters
# ----------
#
# Document parameters here.
#
# * `sample parameter`
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# Variables
# ----------
#
# Here you should define a list of variables that this module would require.
#
# * `sample variable`
# Explanation of how this variable affects the function of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# Examples
# --------
#
# @example
# class { 'nimsoft':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# Authors
# -------
#
# Author Name <author@domain.com>
#
# Copyright
# ---------
#
# Copyright 2018 Your name here, unless otherwise noted.
#
class nimsoft (
String $domain,
String $hub,
Variant $hub_ip,
String $hub_robot_name = undef,
Integer $hub_port,
Stdlib::Absolutepath $config_file,
String $package_name,
String $package_ensure,
String $service_name,
String $service_ensure,
Boolean $service_enable,
Optional[Variant] $robot_ip = undef,
) {

file{$config_file:
ensure => present,
owner => 'root',
group => 'root',
mode => '0664',
content => template('nimsoft/nms-robot-vars.cfg.erb'),
notify => Exec['RobotConfigurer.sh'],
require => Package[$package_name],
}

exec{'RobotConfigurer.sh':
path => [ '/bin', '/opt/nimsoft/install', ],
refreshonly => true,
notify => Service[$service_name],
}

package{$package_name:
ensure => $package_ensure,
}

service{$service_name:
ensure => $service_ensure,
enable => $service_enable,
require => File[$config_file],
}

}
7 changes: 6 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"source": "https://github.com/stschulte/puppet-nimsoft.git",
"project_page": "https://github.com/stschulte/puppet-nimsoft",
"issues_url": "https://github.com/stschulte/puppet-nimsoft/issues",
"dependencies": [ ],
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.13.1 < 5.0.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down
22 changes: 22 additions & 0 deletions templates/nms-robot-vars.cfg.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is being maintained by Puppet.
# DO NOT EDIT

<% if @domain -%>
domain=<%= @domain %>
<% end -%>
<% if @hub -%>
hub=<%= @hub%>
<% end -%>
<% if @hub_ip -%>
hubip=<%= @hub_ip %>
<% end -%>
<% if @robot_ip -%>
robotip=<%= @hubip %>
<% end -%>
<% if @hub_robot_name -%>
hubrobotname=<%= @hub_robot_name %>
<% end -%>
<% if @hub_port -%>
hubport=<%= @hub_port %>
<% end -%>