[OpenWrt-Devel] Configuration management for OpenWrt

Wes Turner wes.turner at gmail.com
Wed Apr 8 17:30:37 EDT 2020


/etc in git + Shell script + Ansible

I wrote a shell script that drops lock files in /etc/setup when that
function has successfully run without error.
If the lock file exists (test -f "/etc/setup/${lockname}"), the function
doesn't run again whenever I re-run the shell script.
I include /etc/setup/ and /etc/bin/ in /etc/sysupgrade.conf.

I haven't yet hooked post-upgrade somehow so that the setup shell script
runs automatically after upgrading OpenWRT firmware.
I could probably check /etc/openwrt_release and /etc/openwrt_version to
determine whether the version has changed.
https://openwrt.org/docs/techref/sysupgrade

https://github.com/gekmihesg/ansible-openwrt
> Manage OpenWRT and derivatives with Ansible but without Python

This runs an OpenWRT docker container with an interactive shell that IDK
how to kill without killing the PID or various incantations of
Ctrl-C/Ctrl-D/Ctrl-Z:

docker image pull openwrtorg/rootfs
docker run --rm -it --name=openwrt1 -h hostname --cap-add NET_ADMIN -v
$(readlink -e ./setup_openwrt.sh):/setup_openwrt.sh:ro -v $(readlink -e
./entrypoint.sh):/entrypoint.sh:ro openwrtorg/rootfs



On Wed, Apr 8, 2020 at 5:08 PM Paul Spooren <mail at aparcar.org> wrote:

> Hi all,
>
> I was wondering if there are some best practices for configuration
> management of OpenWrt devices. I understand that it is fairly easy to
> get/restore a backup of the etc/config folder, but though maybe there
> are some smarter ways.
>
> Ideally a local state (e.g. git repository) would deploy multiple
> devices and automatically update them via a command (or even cron).
>
> Other projects came up with solutions which seem to heavy for common
> WiFi routers. Ansible[0] is great and all, however requires plenty of
> Python to work conveniently. Then cloud-init[1] is Python as well, I
> think even heavier on the client side than Ansible and also doesn't
> seem to be the right use case.
>
> Some time ago I came up with a MAC based init system[2] but that's not
> really to keep things up to date.
>
> Last thing I know of is the approach to convert folders into opkg
> install-able packages[3], so whenever there is a new configuration all
> pre-configured routers would install it via opkg. However this would
> require an opkg cron on client device and building the config-packages
> appear to be quite some overhead. On the other side it handles
> authentication via usign keys.
>
> Anyway, please recommend me a better way which I'm not aware of!
>
> Best,
> Paul
>
> [0]: https://www.ansible.com/
> [1]: https://cloud-init.io/
> [2]: https://github.com/openwrt/packages/pull/6071
> [3]: https://github.com/libremesh/network-profiles-builder
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200408/aa30a688/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list