• 博客
  • Ansible 社区论坛
  • 文档
Ansible Logo
Ansible 社区文档
Ansible

Ansible 入门

  • Ansible 入门
  • 执行环境入门

安装、升级和配置

  • 安装指南
  • Ansible 移植指南

使用 Ansible

  • 构建 Ansible 清单
  • 使用 Ansible 命令行工具
  • 使用 Ansible Playbook
  • 使用 Ansible Vault 保护敏感数据
  • 使用 Ansible 模块和插件
  • 使用 Ansible 集合
  • 在 Windows 和 BSD 上使用 Ansible
  • Ansible 技巧和诀窍

为 Ansible 做贡献

  • Ansible 社区指南
  • Ansible 集合贡献者指南
  • ansible-core 贡献者指南
  • 高级贡献者指南
  • Ansible 文档风格指南

扩展 Ansible

  • 开发者指南

常见 Ansible 场景

  • 遗留公有云指南

网络自动化

  • 网络入门
  • 网络高级主题
  • 网络开发者指南

Ansible Galaxy

  • Galaxy 用户指南
  • Galaxy 开发者指南

参考 & 附录

  • 集合索引
    • Amazon 命名空间中的集合
    • Ansible 命名空间中的集合
    • Arista 命名空间中的集合
    • Awx 命名空间中的集合
    • Azure 命名空间中的集合
    • Check_point 命名空间中的集合
    • Chocolatey 命名空间中的集合
    • Cisco 命名空间中的集合
    • Cloud 命名空间中的集合
    • Cloudscale_ch 命名空间中的集合
    • Community 命名空间中的集合
      • Community.Aws
      • Community.Ciscosmb
      • Community.Crypto
      • Community.Digitalocean
      • Community.Dns
      • Community.Docker
      • Community.General
        • 描述
        • 沟通
        • 更新日志
        • 指南
        • 云指南
        • 开发者指南
        • 插件索引
      • Community.Grafana
      • Community.Hashi_Vault
      • Community.Hrobot
      • Community.Library_Inventory_Filtering_V1
      • Community.Libvirt
      • Community.Mongodb
      • Community.Mysql
      • Community.Network
      • Community.Okd
      • Community.Postgresql
      • Community.Proxysql
      • Community.Rabbitmq
      • Community.Routeros
      • Community.Sap_Libs
      • Community.Sops
      • Community.Vmware
      • Community.Windows
      • Community.Zabbix
    • Containers 命名空间中的集合
    • Cyberark 命名空间中的集合
    • Dellemc 命名空间中的集合
    • F5networks 命名空间中的集合
    • Fortinet 命名空间中的集合
    • Frr 命名空间中的集合
    • Gluster 命名空间中的集合
    • Google 命名空间中的集合
    • Grafana 命名空间中的集合
    • Hetzner 命名空间中的集合
    • Hpe 命名空间中的集合
    • Ibm 命名空间中的集合
    • Ieisystem 命名空间中的集合
    • Infinidat 命名空间中的集合
    • Infoblox 命名空间中的集合
    • Inspur 命名空间中的集合
    • Junipernetworks 命名空间中的集合
    • Kaytus 命名空间中的集合
    • Kubernetes 命名空间中的集合
    • Kubevirt 命名空间中的集合
    • Lowlydba 命名空间中的集合
    • Mellanox 命名空间中的集合
    • Microsoft 命名空间中的集合
    • Netapp 命名空间中的集合
    • Netapp_eseries 命名空间中的集合
    • Netbox 命名空间中的集合
    • Ngine_io 命名空间中的集合
    • Openstack 命名空间中的集合
    • Openvswitch 命名空间中的集合
    • Ovirt 命名空间中的集合
    • Purestorage 命名空间中的集合
    • Sensu 命名空间中的集合
    • Servicenow 命名空间中的集合
    • Splunk 命名空间中的集合
    • T_systems_mms 命名空间中的集合
    • Telekom_mms 命名空间中的集合
    • Theforeman 命名空间中的集合
    • Vmware 命名空间中的集合
    • Vultr 命名空间中的集合
    • Vyos 命名空间中的集合
    • Wti 命名空间中的集合
  • 所有模块和插件的索引
  • Playbook 关键字
  • 返回值
  • Ansible 配置设置
  • 控制 Ansible 的行为:优先级规则
  • YAML 语法
  • Python 3 支持
  • 解释器发现
  • 发布和维护
  • 测试策略
  • 健全性测试
  • 常见问题解答
  • 词汇表
  • Ansible 参考:模块实用工具
  • 特殊变量
  • 红帽 Ansible 自动化平台
  • Ansible 自动化中心
  • 记录 Ansible 输出

路线图

  • Ansible 路线图
  • ansible-core 路线图




Ansible
  • 集合索引
  • Community 命名空间中的集合
  • Community.General
  • community.general.clc_alert_policy 模块 – 在 CenturyLink Cloud 创建或删除警报策略
  • 在 GitHub 上编辑

community.general.clc_alert_policy 模块 – 在 CenturyLink Cloud 创建或删除警报策略

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。

要安装它,请使用:ansible-galaxy collection install community.general。您需要进一步的要求才能使用此模块,请参阅 要求 以了解详细信息。

要在 playbook 中使用它,请指定:community.general.clc_alert_policy。

  • 概要

  • 要求

  • 参数

  • 属性

  • 注意

  • 示例

  • 返回值

概要

  • 一个 Ansible 模块,用于在 CenturyLink Cloud 创建或删除警报策略。

要求

在执行此模块的主机上需要以下要求。

  • python = 2.7

  • requests >= 2.5.0

  • clc-sdk

参数

参数

注释

alert_recipients

列表 / 元素=字符串

用于通知警报的收件人电子邮件 ID 列表。 这是状态“present”所必需的

alias

字符串 / 必需

您的 CLC 帐户的别名

duration

字符串

条件必须超过阈值的分钟数。 这是状态“present”所必需的

id

字符串

警报策略 ID。 这与名称互斥

metric

字符串

用于测量将触发警报的条件的指标。 这是状态“present”所必需的

选择

  • "cpu"

  • "memory"

  • "disk"

name

字符串

警报策略的名称。 这与 ID 互斥

state

字符串

是否创建或删除策略。

选择

  • "present" ← (默认)

  • "absent"

threshold

整数

当指标等于或超过它时将触发警报的阈值。 这是状态“present”所必需的。 此数字表示一个百分比,并且必须是介于 5.0 - 95.0 之间的 5.0 的倍数的值

属性

属性

支持

描述

check_mode

支持:完全

可以在 check_mode 中运行,并返回更改的状态预测,而无需修改目标。

diff_mode

支持:无

在 diff 模式下,将返回有关已更改(或可能需要在 check_mode 中更改)的详细信息。

注意

注意

  • 要使用此模块,需要设置以下环境变量,这些变量允许访问 CenturyLink Cloud - CLC_V2_API_USERNAME,用于 CenturyLink Cloud 的帐户登录 ID - CLC_V2_API_PASSWORD,用于 CenturyLink Cloud 的帐户密码

  • 或者,该模块接受 API 令牌和帐户别名。 可以使用 CLC 帐户登录名和密码通过 HTTP API 调用 @ https://api.ctl.io/v2/authentication/login 生成 API 令牌 - CLC_V2_API_TOKEN,从 https://api.ctl.io/v2/authentication/login 生成的 API 令牌 - CLC_ACCT_ALIAS,与 CenturyLink Cloud 关联的帐户别名

  • 用户可以设置 CLC_V2_API_URL 来指定指向不同 CLC 环境的端点。

示例

# Note - You must set the CLC_V2_API_USERNAME And CLC_V2_API_PASSWD Environment variables before running these examples

---
- name: Create Alert Policy Example
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: Create an Alert Policy for disk above 80% for 5 minutes
      community.general.clc_alert_policy:
        alias: wfad
        name: 'alert for disk > 80%'
        alert_recipients:
            - [email protected]
            - [email protected]
        metric: 'disk'
        duration: '00:05:00'
        threshold: 80
        state: present
      register: policy

    - name: Debug
      ansible.builtin.debug: var=policy

- name: Delete Alert Policy Example
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: Delete an Alert Policy
      community.general.clc_alert_policy:
        alias: wfad
        name: 'alert for disk > 80%'
        state: absent
      register: policy

    - name: Debug
      ansible.builtin.debug: var=policy

返回值

常用返回值在此处记录,以下是此模块独有的字段

键

描述

policy

字典

告警策略信息

返回: 成功

示例: {"actions": [{"action": "email", "settings": {"recipients": ["user1@domain.com", "user1@domain.com"]}}], "id": "ba54ac54a60d4a4f1ed6d48c1ce240a7", "links": [{"href": "/v2/alertPolicies/alias/ba54ac54a60d4a4fb1d6d48c1ce240a7", "rel": "self", "verbs": ["GET", "DELETE", "PUT"]}], "name": "test_alert", "triggers": [{"duration": "00:05:00", "metric": "disk", "threshold": 80.0}]}

作者

  • CLC Runner (@clc-runner)

集合链接

  • 问题跟踪器
  • 仓库(源代码)
  • 寻求帮助
  • 提交错误报告
  • 请求功能
  • 沟通
上一个 下一个

© 版权归 Ansible 项目贡献者所有。 最后更新于 2024 年 12 月 19 日。