Skip to content

udzura/puppet-report_slack2

Repository files navigation

puppet-report_slack2

Yet another slack report processor.

screen

Install && setup

Run:

puppet module install udzura-report_slack2
# or use librarian-puppet

Create config file /etc/puppet/slack.yaml as:

---
username: "puppet reporter"
webhook: "https://hooks.slack.com/services/YOUR/incoming-web-hook/AddRess!!!"
channels:
  - "#udzura_dev"
report_url: 'https://puppetdashboard.example.jp/reports'
http_proxy: 'http://proxy.example.com:3128' # Optionally specify an http proxy to use when posting to slack.

Puppet way, like this:

class { 'report_slack2' :
  username   => 'puppet reporter',
  webhook    => 'https://hooks.slack.com/services/YOUR/incoming-web-hook/AddRess!!!',
  channels   => [ "#udzura_dev" ],
  report_url => 'https://puppetdashboard.example.jp/reports',
}

Then set reporter:

[master]
...

report  = true
reports = store,slack

Reports URL

The reports URL can be left empty in the slack.yaml file for standalone setups and will appear in the Slack status message.

reports_url: ''

If a report URL is set to a non empty value it will be included in the Slac status message.

report_url: 'https://puppetdashboard.example.jp/reports'

The reports_url property also provides the ability to set interpolation of a hostname with self.host by using the %h sting within the reports_url value. In the example below %h will be replaced with ths hostname of provisioned host. To create a link directly to a focused reports section

reports_url: 'https://puppetdashboard.example.jp/%h/reports'

The above translates to something like https://puppetdashboard.example.jp/app001.example.jp/reports

Change what you want to notify

If you want to notify only failed status, you can set slack.yaml like the following:

statuses: 'failed'

or, you want to notify all statuses, set like the following:

statuses: 'changed,failed,unchanged'

See also

License

MIT.