INFO
# cat main.yml
---
- hosts: mikrotiks
  gather_facts: no
  connection: network_cli
  vars:
    ansible_network_os: routeros
    manage_firewall: true
    manage_vpn: true
    manage_wireless_interface: true
    management_subnet: 10.0.10.0/24,10.0.20.0/24,192.168.88.0/24
    vlans:
    - 10:
        untagged_interfaces: ether2
        tagged_interfaces: bridge1,ether3,ether4
        network: 10.0.10.0
        netmask: 24
        ip_address1: 10.0.10.1
        ip_address2: 10.0.10.2
        dns: 192.168.88.1
        dhcp_pool1: 10.0.10.101-10.0.10.150
        dhcp_pool2: 10.0.10.151-10.0.10.200
        leasetime: 1d

  tasks:
    - import_tasks: coba.yml
    
# cat coba.yml
---
- name: add vlan
  routeros_command:
    commands:
    - "/interface vlan add interface=bridge1 name=VLAN-{{ item.key }} 
vlan-id={{ item.key }}"
  #loop: "{{ vlans|dict2items }}"
  with_dict: "{{ vlans }}"
  
PROBLEMS:
1. playbook run normally but since with_dict is deprecated
how to replace it with loop
https://cn-ansibledoc.readthedocs.io/zh_CN/latest/user_guide/playbooks_loops.html

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bdc21a0c-8ec5-422b-9694-62fb390c1099n%40googlegroups.com.

Reply via email to