expanded Readme!

This commit is contained in:
Daan
2024-11-27 19:24:15 +01:00
parent 62c0f5daf7
commit 360654501d

View File

@@ -1,9 +1,46 @@
# Meshbook # Meshbook
A way to programmatically manage MeshCentral-managed machines, a bit like Ansible does. A way to programmatically manage MeshCentral-managed machines, a bit like Ansible does.<br>
What problem does it solve? Well, what I wanted to be able to do is to automate system updates through [MeshCentral](https://github.com/ylianst/meshcentral).<br>
And many people will be comfortable with YAML configurations! It's almost like JSON, but different!<br>
# Quick-start:
The quickest way to start is to grab a template from the templates folder in this repository.<br>
Make sure to correctly pass the MeshCentral websocket API as `wss://<MeshCentral-Host>/control.ashx`.<br>
And make sure to fill in the credentails of an account which has remote commands permissions.<br>
Then make a yaml with a target and some commands! See below examples as a guideline. And do not forget to look at the bottom's notice.
# Example: # Example:
For the example, I used the following yaml file:
```yaml
---
name: Ping a single Point
company: Temp-Agents
tasks:
- name: Ping Cloudflare
command: "ping 1.1.1.1 -c 4"
```
The above group: `Temp-Agents` has four devices, of which one is offline.<br>
You can expand the command chain as follows:<br>
```yaml
---
name: Ping Multiple Points
company: Temp-Agents
tasks:
- name: Ping Cloudflare
command: "ping 1.1.1.1 -c 4"
- name: Ping Google
command: "ping 8.8.8.8 -c 4"
```
The following response it received when executing the first yaml of the above files.
```shell ```shell
python3 meshbook.py --playbook examples/ping.yaml --silent python3 meshbook.py --playbook examples/ping.yaml --silent
3 3
@@ -34,7 +71,17 @@ Running task: {'name': 'Ping Cloudflare', 'command': 'ping 1.1.1.1 -c 4'}
} }
0 0
``` ```
Please ignore the module output in the example, I will remove that in a later version.
# P.S.: # Important Notice:
If you want to use this, make sure to use NON-BLOCKING commands. MeshCentral does not work if you send it commands that wait. If you want to use this, make sure to use `NON-BLOCKING` commands. MeshCentral does not work if you send it commands that wait.<br>
A couple examples of `BLOCKING COMMANDS` which will never get back to the main MeshCentral server:
```shell
apt upgrade # without -y.
sleep infinity
ping 1.1.1.1 # without a -c flag (because it pings forever).
```