2022-11-15 23:11:14 +01:00

35 lines
959 B
YAML

---
- name: add vlans
local_action:
module: vmware_portgroup
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
hosts: "{{ item.0.hosts }}"
switch_name: "{{ item.0.switch_name }}"
vlan_id: "{{ item.1.id }}"
portgroup_name: "{{ item.1.name }}"
state: present
with_nested:
- "{{ vmw_hosts }}"
- "{{ vlan }}"
- name: delete vlans
local_action:
module: vmware_portgroup
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
hosts: "{{ item.0.hosts }}"
switch_name: "{{ item.0.switch_name }}"
portgroup_name: "{{ item.1.name }}"
state: absent
with_nested:
- "{{ vmw_hosts }}"
- "{{ delete_vlan }}"
when: "delete_vlan is defined and delete_vlan is iterable"
# vim: set tabstop=2 shiftwidth=2 expandtab smarttab: