Re: [OpenWrt-Devel] Configuration management for OpenWrt

2020-04-08 Thread Wes Turner
/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  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@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Configuration management for OpenWrt

2020-04-08 Thread Joel Wirāmu Pauling
Ansible doesn't require or need python on targets. In fact it's one of it's
biggest selling points and why over a 3rd of modules are network device
centric.

There is a UCI module for openwrt:

https://github.com/lefant/ansible-openwrt-uci

I tend to redeploy images/snapshots to VM's and then run opkg via ansible
or scripts and copy over config files.

-Joel




On Thu, 9 Apr 2020 at 09:08, Paul Spooren  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@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Configuration management for OpenWrt

2020-04-08 Thread Paul Spooren
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@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel