Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
puppet
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
598027de
authored
Nov 14, 2019
by
source_reader
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on refactor
parent
5c3b58f7
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
53 additions
and
198 deletions
modules/joule/manifests/config.pp
modules/joule/manifests/init.pp
modules/joule/manifests/install.pp
modules/joule_labjack/manifests/init.pp
modules/nginx/files/joule.conf
modules/nginx/manifests/config.pp
modules/nginx/templates/nginx.conf.erb
modules/nilm/manifests/init.pp
modules/nilmdb/files/nilmdb.service
modules/nilmdb/manifests/config.pp
modules/nilmdb/manifests/init.pp
modules/nginx/manifests/install.pp → modules/nilmdb/manifests/install.pp
modules/nilmplug/manifests/init.pp
modules/timescaledb/manifests/#init.pp#
modules/timescaledb/manifests/init.pp
vagrant/Vagrantfile
modules/joule/manifests/config.pp
View file @
598027de
...
...
@@ -29,6 +29,19 @@ class joule::config {
path
=>
[
'/usr/local/pgsql/bin'
,
'/usr/bin:/bin'
],
require
=>
Postgresql
::
Server
::
Db
[
'joule'
]
}
$dsn
=
'joule:joule@localhost:5432/joule'
if
$facts
[
'image_type'
]
==
'nilm'
{
$cmd
=
"joule admin initialize --dsn=
${dsn}
--nilmdb=http://localhost/nilmdb"
}
else
{
$cmd
=
"joule admin initialize --dsn=
${dsn}
"
}
exec
{
'initialize_joule'
:
command
=>
$cmd
,
path
=>
[
'/usr/local/bin'
,
'/usr/sbin'
,
'/bin'
],
creates
=>
'/etc/joule/main.conf'
,
require
=>
Exec
[
'custom_sql'
]
}
postgresql::server::pg_hba_rule
{
'allow remote access for modules'
:
description
=>
'allow network access to joule database'
,
...
...
modules/joule/manifests/init.pp
View file @
598027de
# == Class: joule
#
# Install the joule framework
# doc.wattsworth.net/joule
#
# === Authors
#
# John Donnal <donnal@usna.edu>
2
#
# === Copyright
#
# Copyright 2017 John Donnal, unless otherwise noted.
#
class
joule
{
contain
joule::install
...
...
modules/joule/manifests/install.pp
View file @
598027de
...
...
@@ -10,19 +10,6 @@ class joule::install{
path
=>
[
'/usr/local/bin'
,
'/usr/bin'
],
}
$dsn
=
'joule:joule@localhost:5432/joule'
if
$facts
[
'nilm'
]
{
$cmd
=
"joule admin initialize --dsn=
${dsn}
--nilmdb=http://localhost/nilmdb"
}
else
{
$cmd
=
"joule admin initialize --dsn=
${dsn}
"
}
exec
{
'initialize_joule'
:
command
=>
$cmd
,
path
=>
[
'/usr/local/bin'
,
'/usr/sbin'
,
'/bin'
],
creates
=>
'/etc/joule/main.conf'
,
require
=>
Exec
[
'install_joule'
,
'custom_sql'
]
}
user
{
'joule'
:
ensure
=>
present
,
uid
=>
901
,
...
...
modules/joule_labjack/manifests/init.pp
View file @
598027de
# == Class: joule_labjack
#
# Full description of class joule_labjack 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 funtion 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
#
# class { 'joule_labjack':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# === Authors
#
# Author Name <author@domain.com>
#
# === Copyright
#
# Copyright 2018 Your name here, unless otherwise noted.
#
class
joule_labjack
{
require
python
require
joule
$pip_url
=
'https://pypi.wattsworth.net/'
$pip_cmd
=
"pip3 install --upgrade --extra-index-url
${pip_url}
"
...
...
modules/nginx/files/joule.conf
View file @
598027de
...
...
@@ -2,7 +2,7 @@
location
/
joule
/ {
proxy_pass
http
://
unix
:/
tmp
/
joule
/
api
:/;
proxy_set_header
X
-
Auth
-
Required
"true"
;
proxy_http_version
1
.
1
:
proxy_http_version
1
.
1
;
proxy_buffering
off
;
proxy_set_header
X
-
Forwarded
-
For
$
remote_addr
;
proxy_set_header
X
-
Api
-
Port
"443"
;
...
...
modules/nginx/manifests/config.pp
View file @
598027de
class
nginx::config
{
if
$facts
[
'
nilm'
]
{
if
$facts
[
'
image_type'
]
==
'nilm'
{
$nilmdb
=
true
notice
(
"nilmdb is true!"
)
file
{
'/etc/nginx/nilmdb.conf'
:
source
=>
'puppet:///modules/nginx/nilmdb.conf'
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
}
}
else
{
$nilmdb
=
false
}
file
{
'/etc/nginx/nginx.conf'
:
content
=>
template
(
'
puppet:///modules/nginx/nginx.conf'
)
content
=>
template
(
'
nginx/nginx.conf.erb'
),
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
require
=>
Package
[
'nginx'
],
}
file
{
'/etc/nginx/joule.conf'
:
source
=>
'puppet:///modules/nginx/joule.conf'
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
require
=>
Package
[
'nginx'
],
}
file
{
'/etc/nginx/lumen.conf'
:
source
=>
'puppet:///modules/nginx/lumen.conf'
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
require
=>
Package
[
'nginx'
],
}
file
{
'/etc/nginx/docs.conf'
:
source
=>
'puppet:///modules/nginx/docs.conf'
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
}
file
{
'/etc/nginx/map.conf'
:
source
=>
'puppet:///modules/nginx/map.conf'
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
require
=>
Package
[
'nginx'
],
}
}
modules/nginx/templates/nginx.conf.erb
View file @
598027de
...
...
@@ -69,15 +69,15 @@ http {
<%
end
-%>
}
server{
listen 443;
listen 443
ssl
;
include /etc/nginx/lumen.conf;
include /etc/nginx/joule.conf;
<%
if
@nilmdb
-%>
<%
if
@nilmdb
==
true
-%>
include /etc/nginx/nilmdb.conf;
<%
end
-%>
# Security configuration
ssl on;
#
ssl on;
ssl_certificate /etc/joule/security/server.crt;
ssl_certificate_key /etc/joule/security/server.key;
}
...
...
modules/nilm/manifests/init.pp
View file @
598027de
# == Class: nilm
# Joule modules for nilm data capture and processing
#
# === Authors
#
# John Donnal <donnal@usna.edu>
#
# === Copyright
#
# Copyright 2017 John Donnal, unless otherwise noted.
#
class
nilm
{
require
python
$pip_url
=
'https://pypi.wattsworth.net/'
$pip_cmd
=
"pip3 install --upgrade --extra-index-url
${pip_url}
"
...
...
modules/nilmdb/files/nilmdb.service
View file @
598027de
...
...
@@ -4,7 +4,7 @@ Description=NilmDB time series database
[Service]
Restart = always
StandardOutput=journal
ExecStartPre = /usr/local/bin/nilmdb-fsck -f -n /opt/data
#
ExecStartPre = /usr/local/bin/nilmdb-fsck -f -n /opt/data
ExecStart = /usr/local/bin/uwsgi --ini /etc/nilmdb/nilmdb.ini
[Install]
...
...
modules/nilmdb/manifests/config.pp
View file @
598027de
class
nilmdb::config
{
file
{
'/etc/nilmdb.ini'
:
source
=>
"puppet:///nilmdb/nilmdb.ini"
,
source
=>
"puppet:///
modules/
nilmdb/nilmdb.ini"
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
,
...
...
@@ -14,7 +14,7 @@ class nilmdb::config{
notify
=>
Service
[
'nilmdb'
]
}
file
{
'/etc/systemd/system/nilmdb.service'
:
source
=>
"puppet:///nilmdb/nilmdb.service"
,
source
=>
"puppet:///
modules/
nilmdb/nilmdb.service"
,
owner
=>
root
,
group
=>
root
,
mode
=>
'0644'
...
...
modules/nilmdb/manifests/init.pp
View file @
598027de
...
...
@@ -22,5 +22,4 @@ class nilmdb {
->
Class
[
'::nilmdb::config'
]
~>
Class
[
'::nilmdb::service'
]
}
}
modules/n
ginx
/manifests/install.pp
→
modules/n
ilmdb
/manifests/install.pp
View file @
598027de
...
...
@@ -11,10 +11,10 @@ class nilmdb::install{
}
$pip_url
=
'https://pypi.wattsworth.net/'
$pip_cmd
=
"pip
2
install --upgrade --extra-index-url
${pip_url}
"
$pip_cmd
=
"pip
3
install --upgrade --extra-index-url
${pip_url}
"
exec
{
'install_nilmdb'
:
command
=>
"
${pip_cmd}
nilmdb
nilmtools
"
,
command
=>
"
${pip_cmd}
nilmdb"
,
timeout
=>
0
,
path
=>
[
'/usr/local/bin'
,
'/usr/bin'
],
require
=>
Package
[
$pip_pkgs
]
...
...
@@ -22,8 +22,8 @@ class nilmdb::install{
file
{
'/opt/data'
:
ensure
=>
directory
,
owner
=>
nilmdb
,
group
=>
nilmdb
,
owner
=>
joule
,
group
=>
joule
,
require
=>
User
[
'joule'
]
}
file
{
'/etc/nilmdb'
:
...
...
modules/nilmplug/manifests/init.pp
View file @
598027de
# == Class: nilmplug
#
# Install software for WEMO retrofit smart plugs
#
# === Authors
#
# John Donnal <donnal@usna.edu>
#
class
nilmplug
{
require
python
require
nilm
$pip_url
=
'https://pypi.wattsworth.net/'
$pip_cmd
=
"pip3 install --upgrade --extra-index-url
${pip_url}
"
...
...
modules/timescaledb/manifests/#init.pp#
deleted
100644 → 0
View file @
5c3b58f7
#
Class
:
timescaledb
#
===========================
#
#
Full
description
of
class
timescaledb
here
.
#
#
Authors
#
-------
#
#
John
Donnal
#
#
class
timescaledb
{
if
$
facts
[
'platform'
]
==
'ubuntu'
{
apt
::
source
{
'postgresql'
:
location
=>
'http://apt.postgresql.org/pub/repos/apt/'
,
release
=>
"${lsbdistcodename}-pgdg"
,
repos
=>
'main'
,
key
=>
{
'id'
=>
'B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8'
,
'server'
=>
'hkp://p80.pool.sks-keyservers.net:80'
}
}
apt
::
ppa
{
'ppa:timescale/timescaledb-ppa'
:
}
package
{
'timescaledb-postgresql-10'
:
ensure
=>
'present'
,
require
=>
[
Apt
::
Source
[
'postgresql'
],
Apt
::
Ppa
[
'ppa:timescale/timescaledb-ppa'
]]
}
class
{
'postgresql::server'
:
}
postgresql
::
server
::
config_entry
{
'shared_preload_libraries'
:
value
=>
'timescaledb'
,
}
}
else
{
class
{
'postgresql::globals'
:
#
bindir
=>
'/usr/local/pgsql/bin'
,
#
confdir
=>
'/var/lib/postgresql/10/main'
,
#
datadir
=>
'/var/lib/postgresql/10/main'
,
version
=>
'11'
,
#
service_name
=>
'postgresql'
,
#
client_package_name
=>
'postgresql-9.6'
,
#
psql_path
=>
'/usr/local/pgsql/bin/psql'
,
}
class
{
'postgresql::server'
:
#
createdb_path
=>
'/usr/local/pgsql/bin/createdb'
,
#
initdb_path
=>
'/usr/local/pgsql/bin/initdb'
,
#
package_ensure
=>
'absent'
,
#
pg_hba_conf_path
=>
'/var/lib/postgresql/10/main/pg_hba.conf'
,
#
pg_ident_conf_path
=>
'/var/lib/postgresql/10/main/pg_ident.conf'
,
#
postgresql_conf_path
=>
'/var/lib/postgresql/10/main/postgresq.conf'
,
#
psql_path
=>
'/usr/local/pgsql/bin/psql'
,
#
}
postgresql
::
server
::
config_entry
{
'shared_preload_libraries'
:
value
=>
'timescaledb'
,
}
}
}
modules/timescaledb/manifests/init.pp
View file @
598027de
...
...
@@ -20,38 +20,18 @@ class timescaledb {
}
apt::ppa
{
'ppa:timescale/timescaledb-ppa'
:
}
package
{
'timescaledb-postgresql-1
0
'
:
package
{
'timescaledb-postgresql-1
1
'
:
ensure
=>
'present'
,
require
=>
[
Apt
::
Source
[
'postgresql'
],
Apt
::
Ppa
[
'ppa:timescale/timescaledb-ppa'
]]
}
class
{
'postgresql::server'
:
}
postgresql::server::config_entry
{
'shared_preload_libraries'
:
value
=>
'timescaledb'
,
}
}
else
{
class
{
'postgresql::globals'
:
# bindir => '/usr/local/pgsql/bin',
# confdir => '/var/lib/postgresql/10/main',
# datadir => '/var/lib/postgresql/10/main',
version
=>
'11'
,
# service_name => 'postgresql',
# client_package_name => 'postgresql-9.6',
# psql_path => '/usr/local/pgsql/bin/psql',
}
class
{
'postgresql::server'
:
# createdb_path => '/usr/local/pgsql/bin/createdb',
# initdb_path => '/usr/local/pgsql/bin/initdb',
# package_ensure => 'absent',
# pg_hba_conf_path => '/var/lib/postgresql/10/main/pg_hba.conf',
# pg_ident_conf_path => '/var/lib/postgresql/10/main/pg_ident.conf',
# postgresql_conf_path => '/var/lib/postgresql/10/main/postgresq.conf',
# psql_path => '/usr/local/pgsql/bin/psql',
#
}
postgresql::server::config_entry
{
'shared_preload_libraries'
:
value
=>
'timescaledb'
,
}
}
# timescaledb is compiled manually on the pi
class
{
'postgresql::globals'
:
version
=>
'11'
,
}
class
{
'postgresql::server'
:
}
postgresql::server::config_entry
{
'shared_preload_libraries'
:
value
=>
'timescaledb'
,
}
}
vagrant/Vagrantfile
View file @
598027de
...
...
@@ -12,7 +12,7 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config
.
vm
.
box
=
"ubuntu/
bionic
64"
config
.
vm
.
box
=
"ubuntu/
disco
64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment