Skip to content

Every server resource, under management.

Lemano reads your Linux servers over SSH and keeps every resource on them under management: known, written down as a declaration, every change versioned and attributed, checked against your Ansible playbooks, and put back when you choose. Nothing to declare first.

Install Read the quick start

web-01: what defines it, and a change made by hand
lemano discover -f targetsTARGET   RESULT      GENERATION   PRIVILEGE   NOTEapp-01   unchanged   -            root        -db-01    unchanged   -            root        -web-01   changed     5            root        objects: 6 added, 0 removed, 6 changed​lemano state list web-01KIND           IDENTITY                CONDITIONS                 NOTESPackage        htop                    -                          -Package        nginx                   -                          -Service        nginx                   -                          -User           alice                   -                          -FirewallRule   in/tcp/22/              -                          -FirewallRule   in/tcp/443/             -                          -FirewallRule   in/tcp/80/              -                          -File           /etc/nginx/nginx.conf   ModifiedConffile           differs from the copy in the package nginx-commonSysctl         net.core.somaxconn      LiveDiffersFromPersisted   -listed 371 of 1812 objects; 1441 counted (--all lists them):  Package   94    installed with the system, or only as dependencies of others​lemano diff web-01 4 5web-01: generation 4 -> 5​Objects:  + FirewallRule/in/tcp/8080/  + SshAuthorizedKey/root/SHA256:acVsM21I0oI5KtQg2LJaoBAYqtF32+HK4gY1xmea8jk  ~ File//etc/nginx/nginx.conf      ~ content changed        -	server_tokens off;        +	server_tokens on;  ...​Attribution:  FirewallRule in/tcp/8080/: added by alice (sudo) at 23:42:24    sudo /usr/sbin/ufw allow 8080/tcp  SshAuthorizedKey root/SHA256:acVsM21I0oI5KtQg2LJaoBAYqtF32+HK4gY1xmea8jk: no record of who changed it  File /etc/nginx/nginx.conf: changed by alice (sudo) at 23:42:24    sudo /usr/bin/sed -i s/server_tokens off/server_tokens on/ /etc/nginx/nginx.conf

Works with what you already run

Linux servers
Tested on Debian 12 and 13, Ubuntu 24.04 and 26.04, and Rocky Linux 9.
Ansible
Your inventory, read by Ansible's own ansible-inventory, and a callback that records every playbook run.
OpenSSH
Your ssh config: host aliases, users, keys, jump hosts and proxy commands. Host keys are pinned.
systemd timers or cron
Lemano has no daemon: a timer or a cron job runs each pass.
Prometheus
The summary as gauges per server, for node_exporter's textfile collector.
Docker and Podman
The bind mounts of every container, read with docker or podman, so the files they use are explained.
Coding agents
An agent skill gives your agent the commands, the JSON fields and the exit codes.

The server, written down

Most servers were never written down. lemano state pull writes one as a declaration: what defines it, grouped by kind, with the usual values of each kind said once.

There is nothing to write first and nothing to change on the server. What is only counted is counted at the head of the document, with the rule that left it out, and a file's text is written only when it is safe to show.

Keep the document in Git and the history of a server becomes a diff you can review. It is read-only today: nothing reads the declaration back yet.

From a server to its declaration State

web-01: its declaration, in part
lemano state pull web-01
# Declaration of the 365 of the 1812 objects read on web-01 that define the
# server.
# The others are counted, not listed:
#   Package 94: installed with the system, or only as dependencies of others
...
spec:
  resources:
    - kind: Service
      defaults:
        state: running
      names:
        - nginx
        - ssh
        ...
    - kind: File
      defaults:
        owner: root
        group: root
        mode: "0644"
      items:
        - name: /etc/nginx/nginx.conf
          spec:
            content: |
              user www-data;
              worker_processes auto;
              ...
        # content not written: the file may hold secrets, it is not world-readable
        - name: /etc/shadow
          spec:
            group: shadow
            mode: "0640"
        ...

See every change, and who made it

Every pass keeps what it found as a numbered generation, written only when something changed. Each change is attributed: to the Ansible run and the task that made it, to a package, or shown as made by hand.

Here, one server's first generations: its first discovery, an Ansible run, a file added by hand between two runs, and a second run that changed nothing.

Reading the history Recording Ansible runs

lemano history web-01
  1. 0 generation 0 first discovery discover · complete ·
  2. 1 generation 1 ansible run site.yml by root: 2 added, 3 changed; all 5 by the run, 4 matched to the task that made them run · complete ·
  3. 2 generation 2 no fact changed; objects: 1 added, 0 removed, 0 changed; ... discover · complete ·
  4. – no generation ansible run site.yml by root: nothing changed run · unchanged ·

Check your servers against your playbooks

Ansible evaluates the playbook in check mode; Lemano compares what each task would do with what it read on the host just before, and lists what is on the host that no role manages.

in sync
A task manages the object and would not change it.
drifted
A task would change the object.
missing
A task wants the object and the host does not have it.
forgotten
On the host, meaningful, and no task manages it.
not tracked
A task the comparison cannot use, with the reason.

With the same playbooks it also records every run, codifies a fix into the role and exports a server to a new project.

Lemano and Ansible Checking servers against your roles

web-01 3 in sync, 1 drifted, 1 missing, 4 forgotten, 1 not tracked coverage 42%
StateObjectTask, or why
driftedFile//etc/nginx/nginx.conf~ content changed
~ /status/size: 1447 -> 1446
role web, task "Deploy nginx.conf" roles/web/tasks/main.yml:9changed by alice 2 hours ago (sudo)
missingFile//etc/nginx/conf.d/status.confrole web, task "Deploy the status page" roles/web/tasks/main.yml:14
forgottenPackage/htopinstalled by hand (not as a dependency)
forgottenSudoRule//etc/sudoers.d/opsa sudo rule outside the distribution's
not trackedrole web, task "Reload nginx" roles/web/tasks/main.yml:25shell or command

not listed: 164 File (files as their package ships them), 132 File (folders), ...
role web: 5 of 6 tasks map to objects (83%)

web-01: a recorded run, then check, codify and export
ansible-playbook -i inventory.yml site.yml
...
lemano: recorded web-01 (generation 1: 5 changes, 1 not matched to a task; new target; baseline moved)
lemano ansible check site.yml -i inventory.yml
...
web-01: 3 in sync, 1 drifted, 1 missing, 4 forgotten, 1 not tracked (coverage 42%)
lemano ansible codify site.yml -i inventory.yml
...
nothing written: add --out FILE to write a patch, or --write to edit the files
lemano ansible export -i inventory.yml --out ansible-web-01
lemano ansible: exported 1 host into ansible-web-01
...
next: ansible-playbook -i ansible-web-01/inventory.yml ansible-web-01/site.yml --check

Put a file back, after you read the plan

lemano revert reads the server again, shows what it will change and asks. Just before each write the server checks the file still matches the preview; a file edited in between is refused.

A revert that writes a file controlling access to the server, such as sshd's configuration, sudoers or firewall rules, runs as a trial: unless you confirm after a fresh login, the server puts the old files back on its own when the window ends.

The revert is recorded as a generation of its own, with how it was approved.

How a revert works

lemano revert web-01 --to 4 --reload nginx /etc/nginx/nginx.conf /root/.ssh/authorized_keys /etc/ufw/user.rules /etc/ufw/user6.rules

web-01: revert to generation 4 (live state read just now, generation 5)Only the paths and keys you named are considered.

/etc/nginx/nginx.conf content changes

--- /etc/nginx/nginx.conf (live)+++ /etc/nginx/nginx.conf (generation 4)@@ -17,3 +17,3 @@ 	types_hash_max_size 2048;-	server_tokens on;+	server_tokens off; 	# server_names_hash_bucket_size 64;

/etc/ufw/user.rules content changes (not shown: the file may hold secrets, it is not world-readable)

/etc/ufw/user6.rules content changes (not shown: the file may hold secrets, it is not world-readable)

/root/.ssh/authorized_keys content changes (not shown: the file may hold secrets, it is not world-readable)

Reloads, after a successful write:
nginx.service (reload)
ufw (ufw reload)

Trial (it writes a file that controls access to the host): the host undoes the changes after 5m0s unless you keep them after a fresh login. If the host reboots during the window it undoes them at boot (before SSH starts with systemd; once atd runs with at).

Plan: 6 to revert, 0 not reverted, as root.

Do you want to revert these changes?
  Enter a value: yes

The fresh login worked.

Keep these changes?
  Enter a value: yes

Results:
  applied  /etc/nginx/nginx.conf
  applied  /etc/ufw/user.rules
  applied  /etc/ufw/user6.rules
  applied  /root/.ssh/authorized_keys
  applied  nginx.service (reload)
  applied  ufw (ufw reload)
  1. 4
  2. 5 live state
  3. 6 reverted to 4

Recorded as generation 6 (complete): reverted to 4.
Approved: yes typed at a terminal.
Trial confirmed (yes typed at a terminal): the host keeps the changes.

How it works

Each pass sends a shell script to the server and reads back what it finds. Nothing is installed there, and reading changes nothing in its configuration; only lemano revert writes. Each generation records the hash of the one before it, so lemano verify can check the whole history.

Lemano on your machine opens one SSH session to the server and sends a shell script on standard input; the server sends records back; Lemano compares them with generation N in its store and writes generation N+1, which records the hash of N, only when something changed. diff, history, summary and verify read the store, not the server.your machinelemanothe storeone SQLite file, content encryptedNhash of NN+1written only when something counted changeddiff, history, summary and verifyread the store, not the serverone SSH session, host key pinneda POSIX sh script on standard inputrecords, read back line by linecompared with generation Nthe serversudo -n sh -sor as the login userreads files and runsread commandsnothing installed,no agent runs thereonly lemano revert writes

What a pass reads

Each object is named by its kind and an identity that does not change when the object is edited, so a changed object is one object changed, not one removed and one added.

Besides the objects, a pass records facts about the server itself: host name, operating system, kernel, virtualization, CPU count and memory, pending updates, whether a reboot is needed, and sshd's effective settings. Kinds, field by field

Package
A package installed by the system's package manager.
Service
A systemd service unit.
User
A local user account.
Group
A local group.
SshAuthorizedKey
A public key that lets someone log in as a local account: one key line of a file sshd reads.
SudoRule
A sudoers file that sudo reads, with its rules, aliases, Defaults lines and includes parsed.
FirewallRule
A firewall rule, and the default policy of a base chain.
File
A file, directory or symbolic link in the configuration locations, and in the users' own files a target names, with its content stored encrypted.
Cron
One scheduled command: a line of a crontab, or a script run from /etc/cron.daily and its siblings.
Mount
A filesystem mounted at a path, or listed in /etc/fstab, or both.
Swap
A swap file or partition, as the kernel, /etc/fstab and systemd know it.
Checkout
A version-control checkout in the configuration locations, such as an application deployed as a git clone: one object, not one per file.
Sysctl
A kernel parameter, with its live value and the value the configuration files set at boot.
ContainerMount
A bind mount of a container: the host folder or file a container uses, and where it sees it.

What changed today, on every server

A systemd timer or a cron job runs a pass every hour and writes the summary of the last day: what changed on which server and who changed it, and what needs a look.

A server no pass could reach is named with how long it has gone unseen, never counted as unchanged; a timer that stopped shows up the same way.

On a quiet day the summary is one line: 1 server since 02:13: 1 unchanged.

Running discovery on a schedule Seeing what changed every day

/etc/systemd/system/lemano-discover.timer

[Timer]
OnCalendar=hourly
RandomizedDelaySec=5min
Persistent=true
/var/lib/lemano/summary.txt, written after each pass

3 servers since yesterday 09:15: 1 not read, 2 unchanged.

mail-02 not read

  • not seen for 6h (blind window open)
  • unreachable for 5h (6 passes)

next: lemano history mail-02 --passes

Read your first server

The install script puts two static binaries in ~/.local/bin on Linux or macOS: lemano and lemano-ansible, which stays beside it. Nothing is installed on your servers.

Install it
The script checks the archive against the release's checksums, needs no sudo, and adds the install folder to your PATH when it is not there yet. Packages, the container image and more.
Describe a server
A target file names the host, the user and a key file; the key is never copied into the store.
Read it
Create the store and its key, then run the first pass. It pins the host key; a changed key is always refused.
install, then read a first server
curl -fsSL https://lemano.dev/install.sh | sh
# describe the server in targets/web-01.yaml, then:
lemano init
lemano discover -f targets --accept-new-host-key

Questions

What Lemano does on your servers, where it keeps what it reads, and how it is licensed.

Security

What does it write on my servers?

Reading a server changes nothing in its configuration; only lemano revert writes: the files and kernel parameters you revert, and for a trial a root-only folder and, with systemd, a unit that undoes the trial at boot, both removed when the trial ends. A revert of ufw's rule files reloads ufw so the rules take effect. On Red Hat family servers, pending updates are counted with dnf -C run as an ordinary account, which keeps a small folder of its own in /var/tmp.

Where does the data live, and what about secrets?

In one SQLite file on the machine that runs Lemano. File content is encrypted with keys sealed by your key file or passphrase. Target files hold references to credentials, never their values, and the server's raw machine ID and boot ID are never stored.

Is it ready?

It is in early development: commands, file formats and the store layout can still change before version 1.0. The changelog says what each release changes.

What is the licence?

Lemano is under the Apache License 2.0, except the Ansible collection, which is under the GNU GPL v3.0 or later.

Start with one server

Build Lemano, point it at a server you know, and change something by hand.

Read the documentation