commit - 9bc314e5b2b2a30ab2fce10168f3ceb9f6a1b8f2
commit + 688c9bfdd4186b11f46855ff989a3f556438e233
blob - d4af1cf9a03eebca09eff59415b38e7246dc7f7d
blob + d9d7b278f84e59567f787f5691f9061cf1b582b1
--- Makefile
+++ Makefile
all: tests
-website: index.md documentation.html
+release: r7.1
+ rm -fr _release/r7-$(UTILITY_VERSION)
+ mkdir -p _release/r7-$(UTILITY_VERSION)
+ cp r7 r7.1 Makefile README.md _release/r7-$(UTILITY_VERSION)
+ cd _release && tar cfv r7-$(UTILITY_VERSION).tar r7-$(UTILITY_VERSION)
+ gzip -9 _release/r7-$(UTILITY_VERSION).tar
+ cp _release/r7-$(UTILITY_VERSION).tar.gz _release/r7-latest.tar.gz
+
+html: index.md documentation.html
pandoc --template=./r7doc.html \
- -s --toc=true \
+ -s --toc=false \
--metadata title='R7' \
--from markdown+smart \
-t html -o index.html index.md
- scp index.html root@campfire:/var/www/inda.re/r7/
- ssh root@campfire chmod 644 /var/www/inda.re/r7/index.html
documentation.html: README.md ./r7
pandoc --template=./r7doc.html \
--metadata title='R7 Documentation' \
--from markdown+smart \
-t html -o documentation.html README.md
- scp documentation.html root@campfire:/var/www/inda.re/r7/
- ssh root@campfire chmod 644 /var/www/inda.re/r7/documentation\*
r7.1: README.md
pandoc --from markdown+smart \
- -t man -o r7.1 README.md
+ -s -t man -o r7.1 README.md
r7.1.pdf: README.md
pandoc --from markdown+smart \
- -t pdf -o r7.1.pdf README.md
+ -s -t pdf -o r7.1.pdf README.md
install:
cp ./r7 $(PREFIX)/bin/
chmod 755 $(PREFIX)/bin/r7
+ cp ./r7.1 $(PREFIX)/man/man1/
+ chmod 644 $(PREFIX)/man/man1/r7.1
# Test suite for r7
R=${SHELL} ${UTILITY}
blob - 8dbd3b9815d76f2022abea37a0d7440075f1efd6
blob + bf26401ae46dcef585cea64e5ac07022e3900f9f
--- README.md
+++ README.md
---
-title: "R7 Documentation"
-man_manual: "r7(1)"
+title: R7
section: 1
+header: User Manual
+footer: v0.0.1
+date: Tue Jun 3 2025
---
-## Description
-
-R7 is a shell remote configuration management framework designed to:
-
-- work within site specific repositories organized with groups and nodes
-- group functions and execute them in parallel on a list of nodes (hosts)
-- map the executions (`_run/`) to a tree structure (`_output/`)
-- trace the executions of functions and report issues or changes
-
-R7 is inspired by the amazing work made by the [rset](https://scriptedconfiguration.org/) tool.
-
-_Supported shells are ksh93, oksh and yash. Supported platforms are OpenBSD, FreeBSD, NetBSD and GNU/Linux. Busybox support is planned._
-
-_Optional dependencies are openrsync, rsync, column, graphviz and pandoc_
-
## Tutorial
### Introduction
+R7 is a configuration management framework made to configure nodes with
+configuration files and related operations versionned in a central repository.
+To remain code versionning system agnostic, manual or automated versionning is
+left to the user, via makefiles or triggered from r7 `site-config` configuration
+file _(See below)_.
+
+The idea is to store hosts configurations in `nodes/hostname` directories that
+maps each hosts `/etc` and to assign those hosts to configuration groups
+containing the directives to install the configuration and requirements.
+
+_Nodes sub-directories are hostnames understood by the ssh client and
+configuration._
+
+_Currently, r7 requires valid ssh configuration and keyfiles in the repository
+`.ssh/` directory._
+
+_Repositories can be initialized with `rset init` or `rset -w
+path/to/new-repository init`, the user will then have to provide valid
+configurations and keys for `.ssh/` in the newly created directory._
+
+_See [Technical Notes](#technical-notes) for dependencies and supported
+platforms._
+
There is an example of r7 repository:
./nodes/
./.ssh/id_ed25519_r7.pub
./site-config
-_Nodes sub-directories are hostnames understood by the ssh client and
-configuration._
-
-_Currently, r7 requires valid ssh configuration and keyfiles in the repository
-`.ssh/` directory._
-
-_Repositories can be initialized with `rset init` or `rset -w
-path/to/new-repository init`, the user will then have to provide valid
-configurations and keys for `.ssh/` in the newly created directory._
-
There is an example of r7 site configuration (`site-config` file):
```sh
- (error 127) - in tools0 example2 service_A (1748791986)
/bin/sh: <stdin>[155]: service: not found
- :: 1748791986 tools0 ERROR unable to setup service A
+ :: 1748791986 tools0 ERROR unable to setup service A
```
```sh
setup_users() {
- useradd user1
- useradd user2
+ useradd user1 2>/dev/null || :
+ useradd user2 2>/dev/null || :
}
```
crontab -u _myscript - <<-/
MAILTO=$mail_admins
*/5 * * * * myscript
-/
+ /
}
```
| **info** | Default command showing active nodes and summary |
| **init** | Initialize a new work directory |
-### Environment
+## Environment
| Name | Default value | Description |
| ---- | ------------- | ------------|
| SSH_KNOWN_HOSTS | R7_WORKDIR/.ssh/known_hosts | Set the SSH known hosts file |
| SSH_CONNECT_TIMEOUT | 3 | Set the SSH connect timeout |
+
+## Group variables
+
+Those variables are available during the execution of th group file's functions.
+
+| Name | Description |
+| ---- | ----------- |
+| trace_id | Current run trace ID |
+| groupname | Current group name being executed |
+| exitonerror | Cause the error function to exit if equals `yes` |
+| nodename | Contains the output of `nodename` |
+| nodedir | Contains the output of `nodedir` |
+| groupdir | Contains the output of `groupdir` |
+
+
## Group functions
-
Those functions are accessible during the execution of the group file's functions.
1. [trace](#trace)
trace [string...]
```
----
-
### error
***Description:***
error [string...]
```
----
-
### node
***Description:***
node [filename|dirname]
```
----
-
### nodename
***Description:***
nodename
```
----
-
### nodedir
***Description:***
nodename
```
----
-
### groupdir
***Description:***
groupdir
```
----
-
### install
***Description:***
install [-o owner] [-m mode] source destintaion
```
----
-
### groupinstall
***Description:***
groupinstall [-o owner] [-m mode] source destintaion
```
----
-
### nodeinstall
***Description:***
```sh
nodeinstall [-o owner] [-m mode] source destintaion
```
----
### source
nodesource filename
```
-
-
# r7 library
+Usable from the r7 `site-config` file or sourced in the current shell using:
+
+```sh
+. $(command -v r7)
+```
+
+Each functions are declared with underscore names and aliased with dashes.
+Shorter aliases are also available, list all declared aliases with:
+
+```sh
+alias
+```
+
## Interface
1. [info](#info)
info
```
----
-
### usage
***Description:***
unlock
```
----
-
### copy
***Description:***
copy SRC DST
```
----
-
### ssh
***Description:***
ssh OPTION HOST
```
----
-
### ssh-debug
***Description:***
ssh-debug HOST
```
----
-
### ssh-known-hosts
***Description:***
ssh-known-hosts
```
----
-
### ssh-authorized-keys-reset
***Description:***
ssh-authorized-keys-reset HOST
```
----
-
### ssh-accept-new
***Description:***
```sh
ssh-accept-new HOST
```
----
### ssh-control-master-clean
```sh
ssh-control-master-clean
```
----
### ssh-users
```sh
ssh-users
```
----
### ssh-ids
```sh
ssh-ids
```
----
### ssh-authorized-keys
```sh
ssh-authorized-keys
```
----
### ssh-ids-hosts
```sh
ssh-ids-hosts
```
----
## Deployment functions
nodes
```
----
-
### nodes-active
***Description:***
nodes-active
```
----
-
### run-config
***Description:***
run-config
```
----
-
### members
***Description:***
```sh
members REGEXES
```
----
### group
```sh
group GROUPNAME MEMBERS
```
----
### group-functions
group-functions GROUPNAME
```
----
-
### prefix
***Description:***
output-dump
```
----
-
### output-latest
***Description:***
output-latest
```
----
-
### output-status
***Description:***
output-status
```
----
-
### output-duration
***Description:***
output-duration
```
----
-
### output
***Description:***
output HOST GROUPNAME FUNCTION
```
----
-
### trace-id-last
***Description:***
trace-id-last
```
----
-
### output-diffs
***Description:***
output-diffs
```
----
-
### output-permissions
***Description:***
output-permissions
```
----
-
### output-errors
***Description:***
output-errors
```
----
-
### summary
***Description:***
summary
```
----
-
## Digraph output
1. [digraph-host](#digraph-host)
digraph-host
```
----
-
### digraph-ssh-id-hosts
***Description:***
digraph-ssh-id-hosts
```
----
-
## HTML output
1. [html](#html)
----
-
### html
***Description:***
```sh
html
```
+
+## Technical notes
+
+- Supported shells are ksh93, oksh, yash and bash.
+
+- Supported platforms are OpenBSD, FreeBSD, NetBSD and GNU/Linux.
+
+- Busybox support is planned.
+
+- Optional dependencies are openrsync, rsync, column, graphviz and pandoc.
+
+- The HTML output is a work in progress.
blob - 0416c70f82e6f6858332b02be354c29caf543764
blob + 16bfe794ae310ea59756004ea9f47fa4a0aaf5a8
--- r7
+++ r7
fi
;;
info) info ;;
- import) import "$@" ;;
+ import)
+ shift
+ import "$@"
+ ;;
out | output)
shift
output "$@"
function=$5
status=$6
endcode=$7
+ # Traces from _call
case $status in
START)
save_group=$group save_function=$function
}
html() {
- cat <<eof
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>inda.re report</title>
- <style type="text/css" media="screen">
- html { margin: 4%; }
- body {
- margin: 0 auto;
- max-width: 40em;
- padding-left: 50px;
- padding-right: 50px;
- padding-top: 50px;
- padding-bottom: 50px;
- hyphens: auto;
- overflow-wrap: break-word;
- text-rendering: optimizeLegibility;
- font-kerning: normal;
- }
- p {
- text-align: justify;
- text-justify: inter-word;
- }
- @media screen and (min-width: 1000px) {
- html {
- max-width:1300px;
- margin: auto;
- }
- }
- @media (prefers-color-scheme: dark) {
- :root {
- --red: #E05434;
- --green: #20B700;
- --blue: #A7C1E5;
- --buildhead: #474749;
- }
- :link {
- color: #BAD7FF;
- }
- :visited {
- color: #F6BAFF;
- }
- body {
- background-color: #1E1F21;
- color: #EEEFF1;
- }
- }
- </style>
- </head>
- <body>
- <h1>$PWD</h1>
- <nav>
- <ul>
- <li><a href="#Documentation">Documentation</a></li>
- </ul>
- </nav>
- <main>
- <section id="Documentation">
- $(md README.md)
- </section>
- </main>
- <footer>
- <p>r7</p>
- </footer>
- </body>
-</html>
-eof
+ cat <<-eof
+ <!DOCTYPE html>
+ <html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>inda.re report</title>
+ <style type="text/css" media="screen">
+ html { margin: 4%; }
+ body {
+ margin: 0 auto;
+ max-width: 40em;
+ padding-left: 50px;
+ padding-right: 50px;
+ padding-top: 50px;
+ padding-bottom: 50px;
+ hyphens: auto;
+ overflow-wrap: break-word;
+ text-rendering: optimizeLegibility;
+ font-kerning: normal;
+ }
+ p {
+ text-align: justify;
+ text-justify: inter-word;
+ }
+ @media screen and (min-width: 1000px) {
+ html {
+ max-width:1300px;
+ margin: auto;
+ }
+ }
+ @media (prefers-color-scheme: dark) {
+ :root {
+ --red: #E05434;
+ --green: #20B700;
+ --blue: #A7C1E5;
+ --buildhead: #474749;
+ }
+ :link {
+ color: #BAD7FF;
+ }
+ :visited {
+ color: #F6BAFF;
+ }
+ body {
+ background-color: #1E1F21;
+ color: #EEEFF1;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <h1>$PWD</h1>
+ <nav>
+ <ul>
+ <li><a href="#Documentation">Documentation</a></li>
+ </ul>
+ </nav>
+ <main>
+ <section id="Documentation">
+ $(md README.md)
+ </section>
+ </main>
+ <footer>
+ <p>r7</p>
+ </footer>
+ </body>
+ </html>
+ eof
exit 0
}