ableton.amtool

Ansible 角色 ableton.amtool

这个角色在 Ansible 控制主机上安装 amtool(来自 alertmanager)。注意:控制主机是您运行剧本的机器,不是您使用 Ansible 配置的主机。这个角色的目的是在控制主机上提供 amtool 以便创建和过期静默。

要求

Ansible 版本 >= 2.10,并且控制主机需运行 Debian 系列的 Linux 或 macOS。

角色变量

有关必需和可选角色变量的完整文档,请参见 defaults/main.yml 文件。

安装 amtool 后,角色会将 amtool_exe 事实设置为已安装可执行文件的路径。这个事实可以用于在您的剧本中的后续 command 任务中调用 amtool。请注意,这些任务必须被委派到 localhost

示例剧本

---
- name: 为所有主机创建警报静默
  hosts: "all"
  gather_facts: false
  vars:
    alertmanager_url: "https://example.com/alertmanager"
    comment: "由 Ansible 添加"
    expiration_timeout: "4h"

  roles:
    - role: ableton.amtool
      run_once: true

  tasks:
    - name: 为示例警报创建静默
      delegate_to: localhost
      command: "{{ amtool_exe }} \
        --alertmanager.url={{ alertmanager_url }} \
        silence add \
        --comment='{{ comment }}' \
        --duration={{ expiration_timeout }} \
        alertname={{ alert_item }}"
      loop_control:
        loop_var: alert_item
      with_items:
        - "example_alert_one"
        - "example_alert_two"

许可证

MIT

维护者

该项目由以下 GitHub 用户维护:

关于项目

Install amtool on the Ansible control host

安装
ansible-galaxy install ableton.amtool
许可证
Unknown
下载
40.6k
拥有者
Ableton makes Live, Push and Link — unique software and hardware for music creation and performance.