alxsey.openwrt_init
Role Name
Sets up an OpenWrt router. It does the basics like turning on ssh (by setting a password) and configuring the network.
Routers are identified using their MAC address.
Requirements
This role requires a few things: JMESPath libraries and the commands telnet, ping, and arp.
Role Variables
By default, the router's IP is assumed to be "192.168.1.1" (initial_ip), which is set in the defaults/main.yml file. The default netmask is "255.255.255.0" (default_netmask), the default user is "root" (user), and the default password is "openwrt" (password). The router is identified in the inventory by its MAC address (main_mac).
The ansible_host variable can define a different router IP address. The inventory can also provide a user and password to replace the defaults. Other router settings are defined in dictionaries that mimic uci settings (similar to lefant.openwrt-roles).
Currently, only these settings are supported:
- dhcp.lan.ignore
- network.lan.netmask
If the above information is missing, dhcp will be turned off unless the router's IP address matches the ansible host's default gateway. The netmask will default to 255.255.255.0.
Dependencies
This role depends on the lefant.openwrt-uci role to use uci commands.
Example Playbook
Here’s an example of how to use this role, including how to pass variables as parameters:
- hosts: localhost
roles:
- { role: lefant.openwrt-uci }
- { role: alxsey.openwrt_init }
License
GPLv2
Author Information
Alex Ryabtsev