Verified Commit 4c649da3 authored by Florian Pritz's avatar Florian Pritz
Browse files

zabbix-agent: Use sudo to get borg output



Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent 83dfa015
......@@ -6,7 +6,7 @@ use autodie;
use JSON::XS;
use POSIX;
my $json = decode_json(`/usr/local/bin/borg list --json --format '{start}{end}' --sort-by timestamp --last 1`);
my $json = decode_json(`sudo /usr/local/bin/borg list --json --format '{start}{end}' --sort-by timestamp --last 1`);
print encode_json({
last_archive => {
is_checkpoint => $json->{archives}[0]->{archive} =~ m/.checkpoint$/ ? 1 : 0,
......
......@@ -46,6 +46,9 @@
- restart nginx-zabbix.service
when: "'nginx' in group_names"
- name: install sudo config
template: src=zabbix-agent-sudoers.conf.j2 dest=/etc/sudoers.d/zabbix-agent-sudoers
- name: copy nginx-zabbix.service
copy: src=nginx-zabbix.service dest=/etc/systemd/system/nginx-zabbix.service owner=root group=root mode=0644
notify:
......
zabbix-agent ALL=(root) NOPASSWD: /usr/local/bin/borg list --json --format {start}{end} --sort-by timestamp --last 1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment