require 'serverspec' set :backend, :exec puts puts '================================' puts %x(ansible --version) puts '================================' describe package('grafana') do it { should be_installed } end describe file('/etc/grafana/grafana.ini') do it { should be_file } it { should be_mode 640 } it { should be_owned_by 'root' } it { should be_grouped_into 'grafana' } it { should_not contain 'default' } it { should contain 'instance_name = "${HOSTNAME}"' } it { should contain '[security]' } it { should contain 'admin_user = "sysadmin"' } end describe file('/etc/grafana/ldap.toml') do it { should be_file } it { should be_mode 640 } it { should be_owned_by 'root' } it { should be_grouped_into 'grafana' } end describe file('/var/lib/grafana/plugins/grafana-piechart-panel') do it { should be_directory } it { should be_owned_by 'root' } end describe service('grafana-server') do it { should be_enabled } it { should be_running.under('systemd') } end describe port(3000) do it { should be_listening.with('tcp6') } end