39 lines
1.4 KiB
YAML
39 lines
1.4 KiB
YAML
---
|
|
# One-time initialisation playbook for the dlink OpenWrt AP.
|
|
#
|
|
# Run this while your PC is directly connected to a dlink LAN port
|
|
# (factory IP 192.168.1.1, no MikroTik in the picture yet).
|
|
#
|
|
# Applies the same network and firewall config as the main openwrt role,
|
|
# then reloads network in the background. Skips wireless (requires Vault).
|
|
#
|
|
# After this playbook finishes the device is no longer reachable at 192.168.1.1.
|
|
# Plug the WAN port into MikroTik ether3 and use playbooks/openwrt.yml for all
|
|
# further configuration.
|
|
|
|
- name: dlink — one-time network initialisation
|
|
hosts: openwrt
|
|
gather_facts: false
|
|
vars:
|
|
ansible_host: "192.168.1.1"
|
|
ansible_user: root
|
|
|
|
tasks:
|
|
- name: Verify connectivity
|
|
community.openwrt.ping:
|
|
|
|
# import_tasks (static) is used instead of include_tasks (dynamic) so that
|
|
# handler names referenced via notify in the imported files are silently
|
|
# ignored rather than causing an error — no handlers are defined in this
|
|
# play, and the explicit nohup reload below replaces them for the init case.
|
|
- name: Network configuration
|
|
ansible.builtin.import_tasks: ../roles/openwrt/tasks/network.yml
|
|
|
|
- name: Firewall configuration
|
|
ansible.builtin.import_tasks: ../roles/openwrt/tasks/firewall.yml
|
|
|
|
- name: Reload network in background (device will drop off 192.168.1.1)
|
|
community.openwrt.nohup:
|
|
command: /etc/init.d/network reload
|
|
ignore_unreachable: true
|