/
init.pp
59 lines (57 loc) · 1.85 KB
/
init.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# @summary Installs and configures PiWeatherRock
#
# Installs and configures PiWeatherRock
#
# @example Defaults
# include piweatherrock
#
# @example Use an alternate config file
# class { 'piweatherrock':
# config_file => '/home/pi/piweatherrock.json',
# }
#
# @param [Boolean] enable_awesome_desktop
# If using Raspbian Lite you may want to enable this so that you have a lite
# weight desktop and terminal
#
# @param [Stdlib::Unixpath] config_file
# The path to the config file for PiWeatherRock
#
# @param [Stdlib::Unixpath] sample_config_file
# The path to the sample config file that is bundled with PiWeatherRock
#
# @param [String[1]] piweatherrock_version
# The version of piweatherrock to install from PyPI
#
# @param [String[1]] user
# The user who PiWeatherRock will run as
#
# @param [String[1]] group
# The group of the user who PiWeatherRock will run as.
#
class piweatherrock (
Boolean $enable_awesome_desktop = false,
Stdlib::Unixpath $config_file = '/home/pi/piweatherrock-config.json',
Stdlib::Unixpath $sample_config_file = '/usr/local/lib/python3.7/dist-packages/piweatherrock/config.json-sample',
String[1] $piweatherrock_version = '2.1.0',
String[1] $user = 'pi',
String[1] $group = 'pi',
) {
if $facts['kernel'] {
# post notice if not Raspbian 10 or newer
unless ($facts['os']['name'] == 'Debian') and
($facts['os']['distro']['id'] == 'Raspbian') and
(versioncmp($facts['os']['release']['major'], '10') == 0) {
notify {'Untested OS':
message => 'This manifest has only been tested Raspbian 10 (buster)',
before => Class['piweatherrock::install'],
}
}
}
contain piweatherrock::install
contain piweatherrock::config
contain piweatherrock::service
Class['piweatherrock::install']
-> Class['piweatherrock::config']
-> Class['piweatherrock::service']
}