96 lines
3 KiB
Markdown
96 lines
3 KiB
Markdown
title: cdist does not (yet) fully support OpenWrt
|
|
---
|
|
pub_date: 2024-08-02
|
|
---
|
|
author: ungleich networking team
|
|
---
|
|
twitter_handle: ungleich
|
|
---
|
|
_hidden: no
|
|
---
|
|
_discoverable: yes
|
|
---
|
|
abstract:
|
|
How we try to use cdist on openwrt and fail
|
|
---
|
|
body:
|
|
|
|
## cdist config management
|
|
|
|
As many of you know, we use
|
|
[cdist](https://cdi.st) for configuration management at ungleich. And
|
|
we try to manage everything that is not (yet) in kubernetes with it.
|
|
|
|
Today's short blog entry is about using cdist with openwrt.
|
|
|
|
## OpenWrt at ungleich
|
|
|
|
[OpenWrt](https://openwrt.org] is a popular, open source operating
|
|
system used on routers, switches, etc. We use it for providing IPv6
|
|
and IPv4 connectivity to customers world wide.
|
|
|
|
So far most of our devices are configured using shell scripts from our
|
|
[ungleich-tool git
|
|
repository](https://code.ungleich.ch/ungleich-public/ungleich-tools).
|
|
|
|
However as configurations get more complex, we thought about moving
|
|
our configuration also into cdist.
|
|
|
|
## OpenWrt is similar, but not the same
|
|
|
|
OpenWrt is, generally speaking, "just another Linux distribution",
|
|
albeit with a very, very small footprint. It has to be, because the
|
|
storage on a typical router can be in the size of a couple Megabytes.
|
|
Right, not Gigabyte, not Terabyte.
|
|
|
|
For instance this "large" router has about 9 Megabytes of storage:
|
|
|
|
```
|
|
# df -h
|
|
Filesystem Size Used Available Use% Mounted on
|
|
/dev/root 4.0M 4.0M 0 100% /rom
|
|
tmpfs 217.0M 240.0K 216.8M 0% /tmp
|
|
/dev/mtdblock6 9.1M 420.0K 8.7M 4% /overlay
|
|
overlayfs:/overlay 9.1M 420.0K 8.7M 4% /
|
|
tmpfs 512.0K 0 512.0K 0% /dev
|
|
```
|
|
|
|
It does however have 512 MiB of RAM...:
|
|
|
|
```
|
|
# free -m
|
|
total used free shared buff/cache available
|
|
Mem: 444428 57120 370184 240 17124 354048
|
|
Swap: 0 0 0
|
|
```
|
|
|
|
So, openwrt is a Linux distribution, but its environment is a bit more
|
|
challenging than a general purpose Linux distribution.
|
|
|
|
## cdist & openwrt
|
|
|
|
Cdist uses so called "types" to configure systems idempotently. They
|
|
usually require some shell support on the target system, but nothing
|
|
fancy.
|
|
|
|
However in the case of openwrt, cdist is missing some support, as of
|
|
version 7.0.0:
|
|
|
|
* cdist uses the system default ssh and if that uses SFTP instead of
|
|
SCP by default, it will fail, as openwrt, as of 23.05.3, only
|
|
supports legacy scp (-O). Manually patching cdist source code to
|
|
include "-O" fixes this issue for the moment.
|
|
|
|
* the most basic cdist type __file uses "cksum" to create a checksum
|
|
over files to decide whether or not to copy a file. cksum was chosen
|
|
in the first place, as it is very basic and can be found
|
|
everywhere. Well, everywhere but on openwrt...
|
|
|
|
|
|
## Future of cdist & openwrt
|
|
|
|
Both above issues can in theory be addressed, but the __file type is
|
|
very basic and needs some checksumming support. Without it, cdist
|
|
lacks a major feature and can be considered not (yet) usable.
|
|
|
|
Let's see what the future brings.
|