host_file_edit
Edit fleet registry files on a host: clone a template node's entry for a new node, or remove a deleted node's entries. Dry-run shows the diff before backup and safe in-place write.
Instructions
Edit one of the fleet's registry files on a host the way it is done by hand: clone the entry of a template node for a new node (Prometheus overrides, log-collector inventory, reboot-reminder lists, IP lists) or remove the entries of a removed node (e.g. node_servers.keep.txt). Works on plain lines (an IP inside a one-line list is edited in place), JSON and YAML (comments kept). The dry run shows the diff; the file is backed up (.bak-mia-), written in place (owner and mode kept), optionally a unit is reloaded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | clone — добавить копию записи; replace — поменять в самой записи; remove — убрать запись | |
| host | Yes | ||
| path | Yes | ||
| apply | No | false (default) = dry run: show what will happen on which hosts and a planHash. true = run it; needs planHash | |
| match | Yes | text that identifies the entry (template node name / address, or the removed node) | |
| format | No | auto | |
| reload | No | unit to reload (or restart when it cannot reload) afterwards | |
| replace | No | clone: text replacements, e.g. {"node-pl2":"node-pl3","pl2":"pl3"} | |
| planHash | No | planHash from the dry run of the very same call, good for one apply; refused if targets or their state changed since |