Skip to content

Commit da55d91

Browse files
committed
Drop EoL Puppet, update supported OSs, fix example
This makes the list of supported Puppet versions match the ones currently supported by Puppet, Inc. It also tunes the list of supported operating systems a bit and fixes an example that had bad info. Fixes #25
1 parent 798e459 commit da55d91

File tree

4 files changed

+92
-58
lines changed

4 files changed

+92
-58
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
strategy:
1313
matrix:
1414
puppet_versions:
15-
- '5'
1615
- '6'
16+
# - '7' # PDK doesn't support Puppet 7 directly as of 1.18.1
1717

1818
name: Puppet ${{ matrix.puppet_versions }}
1919
steps:

REFERENCE.md

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
## Classes
2525

26-
### `promtail`
26+
### <a name="promtail"></a>`promtail`
2727

2828
promtail's main interface. All interactions should be with this class. The promtail
2929
module is intended to install and configure Grafana's promtail tool for shipping
@@ -37,13 +37,21 @@ logs to Loki.
3737
include promtail
3838
```
3939

40-
#####
40+
##### Sample of defining within a profile
4141

4242
```puppet
4343
class { 'promtail':
44-
config_hash => $config_hash,
45-
password_file_path => '/etc/promtail/.gc_pw',
46-
password_file_content => Sensitive('myPassword'),
44+
clients_config_hash => $clients_config_hash,
45+
positions_config_hash => $positions_config_hash,
46+
scrape_configs_hash => $_real_scrape_configs_hash,
47+
password_file_content => $sensitive_password_file_content,
48+
password_file_path => $password_file_path,
49+
service_ensure => $service_ensure,
50+
server_config_hash => $server_config_hash,
51+
target_config_hash => $target_config_hash,
52+
bin_dir => $bin_dir,
53+
checksum => $checksum,
54+
version => $version,
4755
}
4856
```
4957

@@ -68,22 +76,22 @@ promtail::positions_config_hash:
6876
filename: /tmp/positions.yaml
6977
promtail::scrape_configs_hash:
7078
scrape_configs:
71-
- job_name: system_secure
72-
static_configs:
73-
- targets:
74-
- localhost
75-
labels:
76-
job: var_log_secure
77-
host: "%{facts.networking.fqdn}"
78-
__path__: /var/log/secure
79-
- job_name: system_messages
80-
static_configs:
81-
- targets:
82-
- localhost
79+
- job_name: journal
80+
journal:
81+
max_age: 12h
8382
labels:
84-
job: var_log_messages
83+
job: systemd-journal
8584
host: "%{facts.networking.fqdn}"
86-
__path__: /var/log/messages
85+
relabel_configs:
86+
- source_labels:
87+
- '__journal__systemd_unit'
88+
target_label: 'unit'
89+
- source_labels:
90+
- 'unit'
91+
regex: "session-(.*)"
92+
action: replace
93+
replacement: 'pam-session'
94+
target_label: 'unit'
8795
```
8896

8997
##### Merging scrape configs in Hiera
@@ -99,37 +107,51 @@ class profile::logging::promtail {
99107

100108
#### Parameters
101109

102-
The following parameters are available in the `promtail` class.
110+
The following parameters are available in the `promtail` class:
111+
112+
* [`service_enable`](#service_enable)
113+
* [`service_ensure`](#service_ensure)
114+
* [`clients_config_hash`](#clients_config_hash)
115+
* [`positions_config_hash`](#positions_config_hash)
116+
* [`scrape_configs_hash`](#scrape_configs_hash)
117+
* [`bin_dir`](#bin_dir)
118+
* [`checksum`](#checksum)
119+
* [`version`](#version)
120+
* [`server_config_hash`](#server_config_hash)
121+
* [`target_config_hash`](#target_config_hash)
122+
* [`password_file_path`](#password_file_path)
123+
* [`password_file_content`](#password_file_content)
124+
* [`source_url`](#source_url)
103125

104-
##### `service_enable`
126+
##### <a name="service_enable"></a>`service_enable`
105127

106128
Data type: `Boolean`
107129

108130
The value passed to the service resource's enable parameter for promtail's service
109131

110-
##### `service_ensure`
132+
##### <a name="service_ensure"></a>`service_ensure`
111133

112134
Data type: `Enum['running', 'stopped']`
113135

114136
The value passed to the service resource's ensure parameter for promtail's service
115137

116-
##### `clients_config_hash`
138+
##### <a name="clients_config_hash"></a>`clients_config_hash`
117139

118140
Data type: `Hash`
119141

120142
Describes how Promtail connects to multiple instances of Loki, sending logs to each.
121143
See https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md
122144
for all parameters.
123145

124-
##### `positions_config_hash`
146+
##### <a name="positions_config_hash"></a>`positions_config_hash`
125147

126148
Data type: `Hash`
127149

128150
Describes how to save read file offsets to disk.
129151
See https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md
130152
for all parameters.
131153

132-
##### `scrape_configs_hash`
154+
##### <a name="scrape_configs_hash"></a>`scrape_configs_hash`
133155

134156
Data type: `Hash`
135157

@@ -138,28 +160,28 @@ using a specified discovery method.
138160
See https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md
139161
for all parameters.
140162

141-
##### `bin_dir`
163+
##### <a name="bin_dir"></a>`bin_dir`
142164

143165
Data type: `Stdlib::Absolutepath`
144166

145167
The directory in which to create a symlink to the promtail binary
146168

147-
##### `checksum`
169+
##### <a name="checksum"></a>`checksum`
148170

149171
Data type: `String[1]`
150172

151173
The checksum of the promtail binary.
152174
Note: each platform has its own checksum.
153175
Values can be found with each release on GitHub
154176

155-
##### `version`
177+
##### <a name="version"></a>`version`
156178

157179
Data type: `String[1]`
158180

159181
The version as listed on the GitHub release page
160182
See https://github.com/grafana/loki/releases for a list
161183

162-
##### `server_config_hash`
184+
##### <a name="server_config_hash"></a>`server_config_hash`
163185

164186
Data type: `Optional[Hash]`
165187

@@ -170,7 +192,7 @@ for all parameters.
170192

171193
Default value: ``undef``
172194

173-
##### `target_config_hash`
195+
##### <a name="target_config_hash"></a>`target_config_hash`
174196

175197
Data type: `Optional[Hash]`
176198

@@ -181,15 +203,15 @@ for all parameters.
181203

182204
Default value: ``undef``
183205

184-
##### `password_file_path`
206+
##### <a name="password_file_path"></a>`password_file_path`
185207

186208
Data type: `Optional[Stdlib::Absolutepath]`
187209

188210
The fully qualified path to the file containing the password used for basic auth
189211

190212
Default value: ``undef``
191213

192-
##### `password_file_content`
214+
##### <a name="password_file_content"></a>`password_file_content`
193215

194216
Data type: `Optional[Sensitive[String[1]]]`
195217

@@ -198,7 +220,7 @@ lookup_options defined in `data/common.yaml`
198220

199221
Default value: ``undef``
200222

201-
##### `source_url`
223+
##### <a name="source_url"></a>`source_url`
202224

203225
Data type: `Stdlib::HTTPUrl`
204226

@@ -208,7 +230,7 @@ Default value: `'https://github.com/grafana/loki/releases/download'`
208230

209231
## Functions
210232

211-
### `promtail::strip_yaml_header`
233+
### <a name="promtailstrip_yaml_header"></a>`promtail::strip_yaml_header`
212234

213235
Type: Ruby 4.x API
214236

@@ -250,7 +272,7 @@ Data type: `String`
250272

251273
A string that may start with the ---'s used to denote a YAML file
252274

253-
### `promtail::to_yaml`
275+
### <a name="promtailto_yaml"></a>`promtail::to_yaml`
254276

255277
Type: Ruby 4.x API
256278

manifests/init.pp

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@
6363
# @example
6464
# include promtail
6565
#
66-
# @example
66+
# @example Sample of defining within a profile
6767
# class { 'promtail':
68-
# config_hash => $config_hash,
69-
# password_file_path => '/etc/promtail/.gc_pw',
70-
# password_file_content => Sensitive('myPassword'),
68+
# clients_config_hash => $clients_config_hash,
69+
# positions_config_hash => $positions_config_hash,
70+
# scrape_configs_hash => $_real_scrape_configs_hash,
71+
# password_file_content => $sensitive_password_file_content,
72+
# password_file_path => $password_file_path,
73+
# service_ensure => $service_ensure,
74+
# server_config_hash => $server_config_hash,
75+
# target_config_hash => $target_config_hash,
76+
# bin_dir => $bin_dir,
77+
# checksum => $checksum,
78+
# version => $version,
7179
# }
7280
#
7381
# @example Settings in a Hiera file
@@ -89,22 +97,22 @@
8997
# filename: /tmp/positions.yaml
9098
# promtail::scrape_configs_hash:
9199
# scrape_configs:
92-
# - job_name: system_secure
93-
# static_configs:
94-
# - targets:
95-
# - localhost
96-
# labels:
97-
# job: var_log_secure
98-
# host: "%{facts.networking.fqdn}"
99-
# __path__: /var/log/secure
100-
# - job_name: system_messages
101-
# static_configs:
102-
# - targets:
103-
# - localhost
100+
# - job_name: journal
101+
# journal:
102+
# max_age: 12h
104103
# labels:
105-
# job: var_log_messages
104+
# job: systemd-journal
106105
# host: "%{facts.networking.fqdn}"
107-
# __path__: /var/log/messages
106+
# relabel_configs:
107+
# - source_labels:
108+
# - '__journal__systemd_unit'
109+
# target_label: 'unit'
110+
# - source_labels:
111+
# - 'unit'
112+
# regex: "session-(.*)"
113+
# action: replace
114+
# replacement: 'pam-session'
115+
# target_label: 'unit'
108116
#
109117
# @example Merging scrape configs in Hiera
110118
# class profile::logging::promtail {

metadata.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@
2929
{
3030
"operatingsystem": "CentOS",
3131
"operatingsystemrelease": [
32-
"7"
32+
"7",
33+
"8"
3334
]
3435
},
3536
{
3637
"operatingsystem": "OracleLinux",
3738
"operatingsystemrelease": [
38-
"7"
39+
"7",
40+
"8"
3941
]
4042
},
4143
{
4244
"operatingsystem": "RedHat",
4345
"operatingsystemrelease": [
46+
"7",
4447
"8"
4548
]
4649
},
@@ -53,7 +56,8 @@
5356
{
5457
"operatingsystem": "Debian",
5558
"operatingsystemrelease": [
56-
"9"
59+
"9",
60+
"10"
5761
]
5862
},
5963
{
@@ -66,7 +70,7 @@
6670
"requirements": [
6771
{
6872
"name": "puppet",
69-
"version_requirement": ">= 4.10.0 < 7.0.0"
73+
"version_requirement": ">= 6.1.0 < 8.0.0"
7074
}
7175
],
7276
"pdk-version": "1.18.1",

0 commit comments

Comments
 (0)