diff --git a/cookbooks/nomad/files/lib/systemd/system/promtail-nomad.service b/cookbooks/nomad/files/lib/systemd/system/promtail-nomad.service new file mode 100644 index 0000000..a093d6f --- /dev/null +++ b/cookbooks/nomad/files/lib/systemd/system/promtail-nomad.service @@ -0,0 +1,12 @@ +[Unit] +Description=Grafana Promtail +Documentation=https://github.com/grafana/loki +After=network-online.target + +[Service] +User=root +Restart=always +ExecStart=/usr/local/bin/promtail --config.file=/etc/promtail/nomad.yaml + +[Install] +WantedBy=multi-user.target diff --git a/cookbooks/nomad/setup.rb b/cookbooks/nomad/setup.rb index d18026f..a2a5bcd 100644 --- a/cookbooks/nomad/setup.rb +++ b/cookbooks/nomad/setup.rb @@ -79,3 +79,15 @@ template '/etc/promtail/nomad.yaml' do notifies :restart, 'service[promtail-nomad]' end + +# Deploy the `systemd` configuration: +remote_file '/lib/systemd/system/promtail-nomad.service' do + owner 'root' + group 'root' + mode '644' +end + +# Service setting: +service 'promtail-nomad' do + action [ :enable, :restart ] +end