通过HMC Web Services API管理一个IBM Z模块。

zhmc-ansible-modules的Python项目详细描述


Z HMC ansible modules-用于IBM zhmc Web服务API的ansible模块

Version on PypiTravis test status (master)Docs build status (latest)Test coverage (master)

概述

zhmc ansible modules python包包含可以 管理中的IBM ZLinuxONE计算机上的平台资源 动态分区管理器(DPM)操作模式。

此软件包的目标是能够利用电源和易用性 负责ibm z平台资源的管理。

可以管理的IBM Z资源包括分区、hba、NICs和 虚拟功能。

zhmc ansible modules包中的ansible模块是完全的 idempotent, 遵循一个重要的原则,负责模块。

模块的幂等性允许ansible playbooks指定所需的结束 资源的状态,不管当前状态是什么。例如,一个 可以指定IBM Z分区具有state=active,这意味着 它必须存在并处于活跃的运行状态。取决于电流 分区的状态,模块将采取操作来达到此状态 期望的结束状态:如果分区不存在,它将被创建 起动。如果它存在但不活动,它将启动。如果它已经 活动,什么都不做。其他初始状态,包括过渡 启动或停止等状态也将得到照顾。

模块的幂等性使得ansible playbooks可以重新启动:如果出现错误 发生了一些事情已经改变了,剧本可以简单地 重新运行并自动执行正确的操作,因为初始状态 达到所需的最终状态并不重要

zhmc ansible modules包中的ansible模块是用python编写的 并与硬件管理控制台(hmc)的web服务api交互 通过使用zhmcclientpython的api 包裹。

文件

本项目的完整文件在RTD上: http://zhmc-ansible-modules.readthedocs.io/en/stable/

行动手册示例

以下是在本项目中使用Ansible模块的一些示例:

创建一个停止的分区

此任务确保存在此名称的分区,处于停止状态 并具有一定的财产价值。

----hosts:localhosttasks:-name:Ensure a partition exists and is stoppedzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:description:"zhmcAnsiblemodules:partition1"ifl_processors:2initial_memory:1024maximum_memory:1024minimum_ifl_processing_weight:50maximum_ifl_processing_weight:800initial_ifl_processing_weight:200...# all partition properties are supported

启动分区

如果此任务在上面显示的上一个任务之后运行,则不需要属性 被指定。如果有可能首先需要创建分区, 然后指定属性,如上所述。

----hosts:localhosttasks:-name:Ensure a partition exists and is activezhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:activeproperties:...# see above

删除分区

此任务确保不存在具有此名称的分区。如果它 当前存在,它被停止(如果需要)并被删除。

----hosts:localhosttasks:-name:Ensure a partition does not existzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:absent

在分区中创建一个hba

----hosts:localhosttasks:-name:Ensure HBA exists in the partitionzhmc_hba:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"hba1"state:presentproperties:adapter_name:"fcp1"adapter_port:0description:The HBA to our storagedevice_number:"023F"...# all HBA properties are supported

在分区中创建NIC

----hosts:localhosttasks:-name:Ensure NIC exists in the partitionzhmc_nic:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"nic1"state:presentproperties:adapter_name:"osa1"adapter_port:1description:The NIC to our data networkdevice_number:"013F"...# all NIC properties are supported

在分区中创建虚拟函数

----hosts:localhosttasks:-name:Ensure virtual function for zEDC adapter exists in the partitionzhmc_virtual_function:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"vf1"state:presentproperties:adapter_name:"zedc1"description:The virtual function for our accelerator adapterdevice_number:"043F"...# all VF properties are supported

配置从fcp lun启动的分区

----hosts:localhosttasks:-name:Configure partition for booting via HBAzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:boot_device:storage-adapterboot_storage_hba_name:"hba1"boot_logical_unit_number:"0001"boot_world_wide_port_name:"00cdef01abcdef01"

配置分区的加密配置

----hosts:localhosttasks:-name:Ensure crypto config for partitionzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:crypto_configuration:crypto_adapter_names:-"crypto1"crypto_domain_configurations:-domain_index:17access_mode:"control-usage"-domain_index:19access_mode:"control"

快速启动

有关安装说明,请参见Installation of zhmc-ansible-modules package

在安装了zhmc ansible modules包之后,您可以下载并 在folder ‘playbooks’ of the Git repository

中运行示例剧本
  • create_partition.yml创建一个带有NIC、HBA和virtual的分区 加速器适配器的功能
  • delete_partition.yml删除一个分区。
  • vars_example.yml是定义变量的示例变量文件,例如 CPC名称、分区名称等
  • vault_example.yml是定义变量的密码保管库文件示例 用于通过hmc进行身份验证。

在运行剧本之前,将vars_example.yml复制到vars.ymlvault_example.ymlvault.yml并更改这些文件中的变量 根据需要。

然后,运行示例剧本:

$ ansible-playbook create_partition.yml

PLAY [localhost] **********************************************************

TASK [Gathering Facts] ****************************************************
ok: [127.0.0.1]

TASK [Ensure partition exists and is stopped] *****************************
changed: [127.0.0.1]

TASK [Ensure HBA exists in the partition] *********************************
changed: [127.0.0.1]

TASK [Ensure NIC exists in the partition] *********************************
changed: [127.0.0.1]

TASK [Ensure virtual function exists in the partition] ********************
changed: [127.0.0.1]

TASK [Configure partition for booting via HBA] ****************************
changed: [127.0.0.1]

PLAY RECAP ****************************************************************
127.0.0.1                  : ok=6    changed=5    unreachable=0    failed=0

$ ansible-playbook delete_partition.yml

PLAY [localhost] **********************************************************

TASK [Gathering Facts] ****************************************************
ok: [127.0.0.1]

TASK [Ensure partition does not exist] ************************************
changed: [127.0.0.1]

PLAY RECAP ****************************************************************
127.0.0.1                  : ok=2    changed=1    unreachable=0    failed=0

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android:在ListView上使用setOnItemClickListener   使用Netbeans 7.0连接到SQL Server的java正在挂起   java Spring3依赖项注入不适用于mule   java Flink SQL结果字段与LocalDateTime上请求的类型错误不匹配   java找不到文件的结尾   考虑到NamingStrategy,java有没有办法将字符串转换为JsonNode?   使用Netbeans/ant部署java(命令行)应用程序   java如何修复Spring引导多部分上载中的“所需请求部分不存在”   java在应用程序启动时通过引用获取映射未知目标实体属性异常   java形状旋转问题Java2d   Weblogic服务器上的java ExecuteAndWaitInterceptor问题   JavaSpringBoot:project将图像保存在错误的路径中,并且在使用IDEIntellji打开时不显示图像   类向java接口添加方法   Swing组件上的Java 7泛型   sql server如何从java获取用户名。sql。联系   java如何检查该行是否与正则表达式(regex)冲突?   java如何在spring引导安全中为计数失败登录设置验证登录为false   图像如何在Java中使PNG的白色透明?