Skip to main content

Nornir 的 F5 插件

项目描述

nornir_f5

构建状态 编解码器 用蟒蛇制作 蟒蛇版本 代码风格:黑色 GitHub 许可证

Nornir 插件的集合,用于与 F5 系统交互并将声明部署到 F5 自动化工具链 (ATC) 服务,如 AS3、DO 和 TS。

安装

pip install nornir-f5

诗歌

poetry add nornir-f5

用法

from nornir import InitNornir
from nornir.core.task import Result, Task
from nornir_utils.plugins.functions import print_result

from nornir_f5.plugins.tasks import (
    atc,
    bigip_cm_config_sync,
    bigip_cm_failover_status,
)

def as3_post(task: Task, as3_tenant: str) -> Result:
    # Get the failover status of the device.
    failover_status = task.run(
        name="Get failover status", task=bigip_cm_failover_status
    ).result

    # If it's the ACTIVE device, send the declaration and perform a sync.
    if failover_status == "ACTIVE":
        task.run(
            name="POST AS3 Declaration from file",
            task=atc,
            atc_method="POST",
            atc_service="AS3",
            as3_tenant=as3_tenant,
            atc_declaration_file=task.host["appsvcs"][as3_tenant][
                "atc_declaration_file"
            ],
        )

        task.run(
            name="Synchronize the devices",
            task=bigip_cm_config_sync,
            device_group=task.host["device_group"],
        )

        return Result(
            host=task.host,
            result="ACTIVE device, AS3 declaration successfully deployed.",
        )
    # Else, do nothing...
    else:
        return Result(host=task.host, result="STANDBY device, skipped.")

nr = InitNornir(config_file="config.yml")
nr = nr.filter(platform="f5_bigip")

result = nr.run(
    name="AS3 POST",
    task=as3_post,
    as3_tenant="Simple_01",
)

print_result(result)

插件

连接

  • f5:连接到 F5 REST 服务器。

任务

  • atc:在 BIG-IP/IQ 系统上部署 ATC 声明。
  • atc_info:返回 ATC 服务实例的版本和发布信息。
  • bigip_cm_config_sync:同步 BIG-IP 系统之间的配置。
  • bigip_cm_failover_status:获取 BIG-IP 系统的故障转移状态。
  • bigip_cm_sync_status:获取 BIG-IP 系统的配置同步状态。
  • bigip_shared_file_transfer_uploads:将文件上传到 BIG-IP 系统。
  • bigip_shared_iapp_lx_package:管理 BIG-IP 系统上的 Javascript LX 包。
  • bigip_sys_version:获取 BIG-IP 系统的软件版本信息。
  • bigip_util_unix_ls:列出有关 BIG-IP 系统上的文件或目录内容的信息。
  • bigip_util_unix_rm:删除 BIG-IP 系统上的文件。

作者

  • 埃里克·雅各布 (@erjac77)

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

nornir_f5-0.5.1.tar.gz (16.5 kB 查看哈希

已上传 source

内置分布

nornir_f5-0.5.1-py3-none-any.whl (22.3 kB 查看哈希

已上传 py3