在配置已创建的虚拟机的网络时,我遇到了两个问题。我有这个代码:
- name: Creates a new Virtual Machine from template named 'rhel7_template'
ovirt_vm:
auth: "{{ ovirt_auth }}"
state: present
name: testaes02
template: tmpl-rhv-dc20-rhel-7
cluster: KVM_DC_20_CL_LC_Linux_01
- ovirt_nic_info:
auth: "{{ ovirt_auth }}"
vm: testaes01
register: result
- debug:
msg: "{{ result.ovirt_nics[0].reported_devices[0].name }}"
- name: Run VM with cloud init
ovirt_vm:
auth: "{{ ovirt_auth }}"
name: testaes01
cloud_init:
custom_script: |
write_files:
- path: /etc/sysconfig/network-scripts/ "{{ result.ovirt_nics[0].reported_devices[0].name }}"
content: |
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.80.156
GATEWAY=192.168.80.1
NETMASK=255.255.255.0
DOMAIN="inf.sta da.inf.sta"
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
runcmd:
- /etc/sysconfig/network-scripts/ "{{ result.ovirt_nics[0].reported_devices[0].name }}"
- command systemctl restart network
user_name: root
root_password: super_password
我的问题是网络文件中没有添加配置网络。
我也想知道是否有类似于 Ovirt 的 vmware_vm_shell 模块的东西