From d1d9546e507445cc77fbe59d1222aca1605f5649 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 7 Oct 2015 14:15:51 -0400 Subject: [PATCH] Initial commit for puppet logic Signed-off-by: Paul Belanger --- manifests/init.pp | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 1900082..1d5b86b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,4 +7,49 @@ # [*sample_parameter*] # Explanation of what this parameter affects and what it defaults to. # -class grafyaml {} +class grafyaml ( + $git_revision = 'master', + $git_source = 'https://git.openstack.org/openstack-infra/grafyaml', +) { + include ::pip + + vcsrepo { '/opt/grafyaml': + ensure => latest, + provider => git, + revision => $git_revision, + source => $git_source, + } + + exec { 'install_grafyaml': + command => 'pip install /opt/grafyaml', + path => '/usr/local/bin:/usr/bin:/bin/', + refreshonly => true, + subscribe => Vcsrepo['/opt/grafyaml'], + } + + file { '/etc/grafyaml': + ensure => directory, + } + + file { '/etc/grafyaml/config': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + recurse => true, + purge => true, + force => true, + source => $config_dir, + require => File['/etc/grafyaml'], + notify => Exec['grafana_dashboards_update'], + } + + exec { 'grafana_dashboards_update': + command => 'grafana-dashboards update /etc/grafyaml/config', + path => '/bin:/usr/bin:/usr/local/bin', + refreshonly => true, + require => [ + Package['python-grafyaml'], + ], + } +}