On routerOS hardware using ansible community.routeros.api_modify module. Within the playbook I can add data to the ip firewall address-list directory.
name: ip address list (NOT READY)
hosts: all
gather_facts: false
ignore_errors: True
vars:
hostname: "{{ ansible_host }}"
password: "{{ ansible_ssh_pass }}"
username: "{{ ansible_user }}"
tasks:
- name: include vars
include_vars:
dir: group_vars/draft-routeros
extensions:
- yml
- yaml
- name: Setup ip_address_list
community.routeros.api_modify:
hostname: "{{ hostname }}"
password: "{{ password }}"
username: "{{ username }}"
path: ip firewall address-list
handle_absent_entries: ignore
handle_entries_content: remove_as_much_as_possible
data:
- list: "{{ item.name }}"
address: "{{ item.address }}"
loop: "{{ ip_fw_address_list }}"
####loop data###
#ip_fw_address_list:
- {name: 'Aggregate', address: '192.168.0.0/24'}
- {name: 'Quarantine', address: '192.158.2.0/24'}
How to realize the deletion of data different from the entered configuration within the same playbook.