【发布时间】:2021-05-05 12:48:36
【问题描述】:
我不会将参数省略与创建 vswitch 的任务一起使用。
我有错误'__omit_place_holder_81417e0c9c0a92falf5ce7dccf224fa67be93fb4'
我不明白这个问题
感谢您的帮助
- name: Add a VMware vSwitch with multiple NICs
community.vmware.vmware_vswitch:
hostname: "{{ hostname.1 }}"
username: "{{ esxi_username }}"
password: "{{ esxi_password }}"
#esxi_hostname: "{{ hostname.1 }}"
switch: "{{ item.name }}"
nics:
- "{{ item.nic1| default(omit)}}"
- "{{ item.nic2| default(omit)}}"
mtu: "{{ item.mtu }}"
number_of_ports: 2
validate_certs: no
delegate_to: localhost
ignore_errors: yes
loop:
- "{{ net_vmk }}"
- "{{ net_vm }}"
- "{{ net_tech }}"
- "{{ net_sto }}"
#conf esxi
hostname:
1: lab-esxi
2:
3:
4:
esxi_username: root
esxi_password: ...
#conf vswitch
net_vmk:
name: vs-vmk
nic2: vmnic4
mtu: 1500
文档 Ansible [1]:https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#making-variables-optional
【问题讨论】:
标签: python variables ansible yaml