ansible-role-borgbackup icon indicating copy to clipboard operation
ansible-role-borgbackup copied to clipboard

borgmatic_hooks compatibility with string hooks

Open kenayagi opened this issue 3 years ago • 2 comments

Some very useful monitoring hooks (like "healthchecks") are defined with a simple string.

The current template is not compatible.

kenayagi avatar Mar 29 '22 13:03 kenayagi

Oh, we want both of course. How can we improve this. Basically all those cases should work, right?

Would a simple Jinja2 IF be sufficient? If it's a string, just write hook+string. Else format YAML, as we do now.

borgmatic_hooks:
  before_backup:
    - echo "`date` - Starting backup."
  postgresql_databases:
    - name: all
      hostname: mysql.internal
      username: postgres
      password: xxx
  healthchecks: "https://hc-ping.com/your-uuid-here"

m3nu avatar Mar 29 '22 14:03 m3nu

Yep. It seems reasonable to me. 👌

kenayagi avatar Apr 08 '22 13:04 kenayagi

It works now, by simply adding something like:

borgmatic_hooks:
  healthchecks:
    ping_url: https://yourhealthchecks.com/ping/your-random-guid

🍻

kenayagi avatar Nov 21 '22 11:11 kenayagi

Yeah, I changed this a few months back to pass the YAML right to Borgmatic. Needed it for database hooks. Glad it helped for this too.

m3nu avatar Nov 21 '22 13:11 m3nu