Loading README.md +6 −1 Original line number Diff line number Diff line # patchman_client Module to install patchman client package and configuration. class {'patchman_client': patchman_server = 'patchman-dev.stanford.edu', wallet_client_netrc = 'wallet_file_name', } manifests/init.pp 0 → 100644 +53 −0 Original line number Diff line number Diff line class patchman_client ( Enum['present', 'absent'] $ensure = 'present', Enum['dev', 'prod'] $env = 'prod', $patchman_server = 'undef', $wallet_client_netrc = 'undef', ) { if ($patchman_server == 'undef') { fail("patchman_server: you need to specify patchman server to send reports") } if ($wallet_client_netrc == 'undef') { fail("wallet_client_netrc: specify the wallet file name to download the patchman netrc ") } package { 'patchman-client': ensure => $ensure, } # Get the .netrc file with the username and password. This is used # to login to the patchman service for uploads. base::wallet { "$wallet_client_netrc": ensure => $ensure, type => 'file', path => "/etc/patchman/patchman.netrc", owner => 'root', group => 'root', mode => '0660', require => Package['patchman-client'], } file { '/etc/patchman/patchman-client.conf': ensure => $ensure, content => template('patchman_client/etc/patchman/patchman-client.conf.erb'), require => Package['patchman-client'], } ## Make sure this file is absent, Otherwise it sends report to patchman server ## everytime when install or upgrade a package file { "/etc/apt/apt.conf.d/05patchman": ensure => absent, } # Install a cron job to update patchman periodically. file { '/etc/cron.daily/patchman-client': ensure => $ensure, content => template('patchman_client/etc/cron.daily/patchman-client.erb'), require => Package['patchman-client'], mode => '0755', } } templates/etc/cron.daily/patchman-client.erb 0 → 100644 +8 −0 Original line number Diff line number Diff line #!/bin/sh # Sleep between 5 and 90 minutes before running SLEEP_MINUTES=$(/usr/bin/shuf -i 5-90 -n 1) SLEEP_SECONDS=$((60 * $SLEEP_MINUTES)) sleep $SLEEP_SECONDS patchman-client -s https://patchman-<%= @env %>.stanford.edu/patchman templates/etc/patchman/patchman-client.conf.erb 0 → 100644 +11 −0 Original line number Diff line number Diff line # Patchman server server=https://<%= @patchman_server %>/patchman # Options to curl curl_options="--netrc-file /etc/patchman/patchman.netrc --connect-timeout 60 --max-time 300" # Space delimited tags to send tags="Server" # Does the client output a report of the upload (e.g. for cronjob output) report=0 Loading
README.md +6 −1 Original line number Diff line number Diff line # patchman_client Module to install patchman client package and configuration. class {'patchman_client': patchman_server = 'patchman-dev.stanford.edu', wallet_client_netrc = 'wallet_file_name', }
manifests/init.pp 0 → 100644 +53 −0 Original line number Diff line number Diff line class patchman_client ( Enum['present', 'absent'] $ensure = 'present', Enum['dev', 'prod'] $env = 'prod', $patchman_server = 'undef', $wallet_client_netrc = 'undef', ) { if ($patchman_server == 'undef') { fail("patchman_server: you need to specify patchman server to send reports") } if ($wallet_client_netrc == 'undef') { fail("wallet_client_netrc: specify the wallet file name to download the patchman netrc ") } package { 'patchman-client': ensure => $ensure, } # Get the .netrc file with the username and password. This is used # to login to the patchman service for uploads. base::wallet { "$wallet_client_netrc": ensure => $ensure, type => 'file', path => "/etc/patchman/patchman.netrc", owner => 'root', group => 'root', mode => '0660', require => Package['patchman-client'], } file { '/etc/patchman/patchman-client.conf': ensure => $ensure, content => template('patchman_client/etc/patchman/patchman-client.conf.erb'), require => Package['patchman-client'], } ## Make sure this file is absent, Otherwise it sends report to patchman server ## everytime when install or upgrade a package file { "/etc/apt/apt.conf.d/05patchman": ensure => absent, } # Install a cron job to update patchman periodically. file { '/etc/cron.daily/patchman-client': ensure => $ensure, content => template('patchman_client/etc/cron.daily/patchman-client.erb'), require => Package['patchman-client'], mode => '0755', } }
templates/etc/cron.daily/patchman-client.erb 0 → 100644 +8 −0 Original line number Diff line number Diff line #!/bin/sh # Sleep between 5 and 90 minutes before running SLEEP_MINUTES=$(/usr/bin/shuf -i 5-90 -n 1) SLEEP_SECONDS=$((60 * $SLEEP_MINUTES)) sleep $SLEEP_SECONDS patchman-client -s https://patchman-<%= @env %>.stanford.edu/patchman
templates/etc/patchman/patchman-client.conf.erb 0 → 100644 +11 −0 Original line number Diff line number Diff line # Patchman server server=https://<%= @patchman_server %>/patchman # Options to curl curl_options="--netrc-file /etc/patchman/patchman.netrc --connect-timeout 60 --max-time 300" # Space delimited tags to send tags="Server" # Does the client output a report of the upload (e.g. for cronjob output) report=0