From a8b8c6b6e21767239ad793b95f8359dc5c1cec61 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 11 Feb 2023 21:17:49 +0900 Subject: [PATCH] Create `prometheus` user. --- cookbooks/prometheus/prometheus_setup.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cookbooks/prometheus/prometheus_setup.rb b/cookbooks/prometheus/prometheus_setup.rb index 975270d..d9e95a4 100644 --- a/cookbooks/prometheus/prometheus_setup.rb +++ b/cookbooks/prometheus/prometheus_setup.rb @@ -1,23 +1,29 @@ +# Create User and group: +user 'prometheus' do + system_user true + shell '/sbin/nologin' +end + # Create `/etc/prometheus.d/`: %w(/etc/prometheus.d).each do |d| directory d do - owner 'root' - group 'root' + owner 'prometheus' + group 'promtheus' mode '0755' end end # Deploy `prometheus` files: remote_file '/etc/prometheus.d/prometheus.yml' do - owner 'root' - group 'root' + owner 'prometheus' + group 'prometheus' mode '644' end # Deploy `supervisor` configuration for `prometheus`: remote_file '/etc/supervisor/conf.d/prometheus.conf' do - owner 'root' - group 'root' + owner 'prometheus' + group 'prometheus' mode '644' notifies :restart, 'service[supervisor]'