ansible - 使用 Ansible 更改参数 VM Ovirt
问题描述
在配置已创建的虚拟机的网络时,我遇到了两个问题。我有这个代码:
- 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 模块的东西
解决方案
推荐阅读
- d3.js - 如何计算 D3 中矩形之间的距离?
- selenium - 一个非常不可思议的问题,Maven变得顽皮,selenium 4.0.0-beta-1
- r - 以相同的顺序将模式的所有元素与向量匹配
- python - 组合两个数据帧,使一个数据帧中的值成为另一个数据帧的标头
- linux - SUID find -exec TCP 连接不是 root
- javascript - Node.js MySQL 连接错误。被拒绝
- amazon-web-services - 在 AWS Kinesis 中,如果我们使用过时/过期的序列号调用 GetShardIterator 会发生什么?
- python - 在pyserial上清除串口的更快方法
- php - 找不到类“照亮\支持\外墙\存储”
- r - 计算非空白列的数量并分配给个别受访者