--- - name: Verify API connectivity and fetch basic facts community.routeros.api_facts: gather_subset: - default - hardware - name: Show target identity ansible.builtin.debug: msg: "Managing {{ ansible_host }} ({{ ansible_facts['net_model'] | default('unknown model') }})" - name: Assert expected router model ansible.builtin.assert: that: - ansible_facts['net_model'] is defined - ansible_facts['net_model'] == "CRS418-8P-8G-2S+" fail_msg: "Unexpected router model: {{ ansible_facts['net_model'] | default('unknown') }}" success_msg: "Router model matches expected CRS418-8P-8G-2S+" - name: Read RouterOS device-mode flags community.routeros.api: path: system/device-mode register: routeros_device_mode check_mode: false changed_when: false - name: Assert container feature is enabled in device mode ansible.builtin.assert: that: - not (routeros_device_mode.skipped | default(false)) - (routeros_device_mode | to_nice_json | lower) is search('container[^a-z0-9]+(yes|true)') fail_msg: "RouterOS device-mode does not report container as enabled. Payload: {{ routeros_device_mode | to_nice_json }}" success_msg: "RouterOS device-mode confirms container=yes"