0

到目前为止,我相信我非常接近让 Ansible 在 oVirt 中启动 VM 模板。我能够毫无问题地进行身份验证,我相信指定配额,但即使它正在启动一个模板,它也找不到它的 data_center。我找不到在 ovirt_vm 模块中定义 data_center 的示例,这就是我所拥有的:

---
# tasks file for ovirt-template-launch
- name: Login to oVirt
  ovirt_auth:
    hostname: "{{ ovirt_hostname }}"
    url: "{{ ovirt_ind_url }}"
    username: "{{ ovirt_login_username }}"
    password: "{{ ovirt_login_password }}"
    insecure: true

- name: Create persistent SSO token
  ovirt_vm:
    auth: "{{ ovirt_auth }}"
    state: absent
    name: myvm

# Gather quota/datacenter
- ovirt_quota_info:
    data_center: "{{ ovirt_datacenter }}"
    name: "{{ ovirt_quota }}"
    auth: "{{ ovirt_auth }}"
  register: result

- name: Run VM with cloud init
  ovirt_vm:
    name: "{{ vmname }}"
    template: centos7-template1
    cluster: Default
    memory: 2GiB
    high_availability: true
    high_availability_priority: 50
    disks:
        - size: 10GiB
          name: data
          storage_domain: mydomain
          interface: virtio
    auth: "{{ ovirt_auth }}" 
    quota_id: "{{ ovirt_quota_id }}"
    cloud_init:
      nic_boot_protocol: static
      nic_ip_address: 10.0.1.5
      nic_netmask: 255.255.254.0
      nic_gateway: 10.0.1.1
      nic_name: eth0
      nic_on_boot: true
      host_name: testdomain.com
      custom_script: |
        write_files:
         - content: |
             Hello, world!
           path: /tmp/greeting.txt
           permissions: '0644'

错误是:

任务执行期间发生异常。要查看完整的回溯,请使用 -vvv。错误是:AttributeError:“NoneType”对象没有属性“data_center”致命:[localhost]:失败!=> {"changed": false, "msg": "'NoneType' 对象没有属性 'data_center'"}

4

0 回答 0