Role - metalsmith_deployment

此 Role 使用 metalsmith CLI 部署实例。

变量

唯一的必需变量是

metalsmith_instances

要配置的实例列表,请参阅 实例 以获取实例描述。

以下可选变量为 实例 属性提供默认值

metalsmith_candidates

candidates 设置的默认值。

metalsmith_capabilities

capabilities 设置的默认值。

metalsmith_conductor_group

conductor_group 设置的默认值。

metalsmith_debug

显示额外的调试信息,默认为 false

metalsmith_extra_args

extra_args 设置的默认值。

metalsmith_image

image 设置的默认值。

metalsmith_image_checksum

image_checksum 设置的默认值。

metalsmith_image_kernel

image_kernel 设置的默认值。

metalsmith_image_ramdisk

image_ramdisk 设置的默认值。

metalsmith_netboot

netboot 设置的默认值

metalsmith_nics

nics 设置的默认值。

metalsmith_resource_class

resource_class 设置的默认值。

metalsmith_root_size

root_size 设置的默认值。

metalsmith_ssh_public_keys

ssh_public_keys 设置的默认值。

metalsmith_state

实例的默认状态,有效值为 reservedabsent 或默认值 present

metalsmith_swap_size

swap_size 设置的默认值。

metalsmith_traits

traits 设置的默认值。

metalsmith_user_name

user_name 设置的默认值,默认值为 metalsmith

实例

每个实例具有以下属性

candidates (默认为 metalsmith_candidates)

要考虑用于部署的节点列表(UUID 或名称)。

capabilities (默认为 metalsmith_capabilities)

在调度时请求的节点功能。

config_drive

要添加到为此实例生成配置驱动程序中的额外数据

cloud_config

要在节点启动时运行的 cloud-init cloud-config 任务的字典。可以使用 ‘users’ 指令来配置除 ‘user_name’ 管理员用户之外的其他用户。

meta_data

要包含在配置驱动程序元数据中的额外元数据。这将添加到生成的元数据 public_keysuuidnamehostname 中。

conductor_group (默认为 metalsmith_conductor_group)

从中选择节点的 conductor 组。

注意

目前无法指定默认组。

extra_args (默认为 metalsmith_extra_args)

要传递给 metalsmith CLI 在所有调用中的其他参数。(不再支持,如果使用将引发错误)

image (默认为 metalsmith_image)

用于部署的镜像的 UUID、名称或 HTTP(s) URL。必需。

image_checksum (默认为 metalsmith_image_checksum)

HTTP(s) 镜像的 SHA256 校验和或校验和文件 URL。

image_kernel (默认为 metalsmith_image_kernel)

如果 image 是分区镜像的 URL,则为内核镜像的 URL。

image_ramdisk (默认为 metalsmith_image_ramdisk)

如果 image 是分区镜像的 URL,则为 ramdisk 镜像的 URL。

netboot

是否从网络(PXE、iPXE 等)启动部署的实例。默认情况下,使用本地启动(需要在镜像上安装引导加载程序)。

nics (默认为 metalsmith_nics)

要附加到节点物理 NIC 的虚拟 NIC 列表。每个对象正好有一个属性

network

在给定网络上创建端口,例如

nics:
  - network: private
  - network: ctlplane

可以可选地分配固定 IP

nics:
  - network: private
    fixed_ip: 10.0.0.2
  - network: ctlplane
    fixed_ip: 192.168.42.30
port

使用提供的预创建端口

nics:
  - port: b2254316-7867-4615-9fb7-911b3f38ca2a
subnet

在给定子网上创建端口,例如

nics:
  - subnet: private-subnet1
resource_class (默认为 metalsmith_resource_class)

请求的节点资源类。必需。

root_size (默认为 metalsmith_root_size)

如果使用分区镜像,则根分区的大小(以 GiB 为单位)。

注意

由于 Bare Metal 服务当前的工作方式,也需要用于整个磁盘镜像。

ssh_public_keys (默认为 metalsmith_ssh_public_keys)

要放在节点上的 SSH 公钥文件的列表。

swap_size (默认为 metalsmith_swap_size)

如果使用分区镜像,则交换分区的大小(以 MiB 为单位)(对于整个磁盘镜像设置它会出错)。

traits

节点应具有的特征列表。

user_name (默认为 metalsmith_user_name)

通过 configdrive 在实例上创建的用户名。需要在镜像上使用 cloud-init

示例

---
- hosts: all
  tasks:
    - include_role:
        name: metalsmith_deployment
      vars:
        metalsmith_image: centos7
        metalsmith_nics:
          - network: ctlplane
        metalsmith_ssh_public_keys:
          - /home/user/.ssh/id_rsa.pub
        metalsmith_instances:
          - hostname: compute-0
            resource_class: compute
            root_size: 100
            swap_size: 4096
            capabilities:
              boot_mode: uefi
            traits:
              - CUSTOM_GPU
          - hostname: compute-1
            resource_class: compute
            root_size: 100
            swap_size: 4096
            capabilities:
              boot_mode: uefi
            user_name: heat-admin
          - hostname: compute-2
            resource_class: compute
            candidates:
              - e63650f2-4e7d-40b2-8932-f5b0e54698c7
              - f19d00dd-60e1-46c8-b83c-782b4d291d9e
          - hostname: control-0
            resource_class: control
            capabilities:
              boot_mode: uefi
            nics:
              - network: ctlplane
              - port: 1899af15-149d-47dc-b0dc-a68614eeb5c4
          - hostname: custom-partition-image
            resource_class: custom
            image: https://example.com/images/custom-1.0.root.img
            image_kernel: https://example.com/images/custom-1.0.vmlinuz
            image_ramdisk: https://example.com/images/custom-1.0.initrd
            image_checksum: https://example.com/images/SHA256SUMS
          - hostname: custom-whole-disk-image
            resource_class: custom
            image: https://example.com/images/custom-1.0.qcow2
            image_checksum: https://example.com/images/SHA256SUMS

模块 - metalsmith_instances

模块文档

使用 metalsmith 配置和取消配置 ironic baremetal 实例,metalsmith 是一个简单的工具,用于使用 OpenStack Bare Metal Service (ironic) 以及可选的 OpenStack Image Service (glance) 和 OpenStack Networking Service (neutron) 配置裸机。

选项

instances:

要对其执行操作的节点描述符列表

clean_up:

在失败时清理资源

state:

所需配置状态,“present” 表示配置,“absent” 表示取消配置,“reserved” 表示创建分配记录而不更改节点状态

wait:

一个布尔值,指示模块是否应在返回之前等待节点配置完成。如果实例数量多于并发数,则默认为“yes”。

timeout:

一个整数值,表示等待节点配置完成的秒数。

concurrency:

一次配置的最大实例数。设置为 0 以没有并发限制

log_level:

设置可在返回的“logging”结果中获得的日志级别。

作者

:

Steve Baker (@stevebaker)

示例任务

- name: Provision instances
  metalsmith_instances:
    instances:
    - name: node-0
      hostname: compute-0
      image: overcloud-full
    state: present
    wait: true
    clean_up: false
    timeout: 1200
    concurrency: 20
    log_level: info
  register: baremetal_provisioned
- name: Metalsmith log for provision instances
  debug:
    var: baremetal_provisioned.logging