Skip to content
Snippets Groups Projects
Verified Commit 52e8ca68 authored by Varac's avatar Varac
Browse files

etc

parent 13a94971
Branches
No related tags found
No related merge requests found
......@@ -2,45 +2,63 @@
## Ansible galaxy
```sh
ansible role list
ansible-galaxy role info borgbase.borgbackup
```
Search on galaxy.ansible.com for roles:
```sh
ansible role search borg
```
Install:
```sh
ansible-galaxy role install jnv.debian-backports
ansible-galaxy role install debops.docker
```
Install from `requirements.yml`
```sh
ansible-galaxy install -r requirements.yml
```
## Ping all hosts
```sh
ansible all -m ping
```
## Gather facts
[Gather facts](http://docs.ansible.com/ansible/latest/setup_module.html)
[Gather facts](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/setup_module.html)
```sh
ansible all -m setup > facts.json
ansible all -m setup --tree ./facts
ansible mumble.digital -m setup > facts.json
```
Disable fact gathering (i.e. for debugging / speeding up the run):
```sh
export ANSIBLE_GATHERING=explicit
```
or:
```sh
ANSIBLE_GATHERING=explicit ansible-playbook -l device.lan site.yml
```
## Deploy only to one host
```sh
ansible-playbook -i 'dashboard.digital,' ssh.yml
```
## Ad-hoc commands
......@@ -48,29 +66,40 @@ or:
Beware the trailing comma !
ansible all -i gl.varac.net, -a uptime
```sh
ansible all -i gl.varac.net -a uptime
ansible all -l server -a reboot
```
### Using an inventory file
<http://docs.ansible.com/ansible/latest/intro_adhoc.html>
```sh
ansible bitrigger.de -m shell -a 'echo hi'
ansible localhost -m debug -a 'msg="{{ traefik_admin_email | checksum }}"'
```
## Debugging
Don't remove target tmp files:
```sh
export ANSIBLE_KEEP_REMOTE_FILES=1
```
List tasks that would be applied:
```sh
ansible-playbook --list-tasks -l internal.digital site.yml
```
List tags that would be applied:
```sh
ansible-playbook --list-tags -l internal.digital site.yml
```
## Using the debugger
......
# ExFAT filesystem
- [Arch wiki: Filesystems](https://wiki.archlinux.org/title/File_systems)
- [exfatprogs](https://archlinux.org/packages/extra/x86_64/exfatprogs/) is installed by default on Arch/Manjaro systems
- [exfat-utils](https://archlinux.org/packages/extra/x86_64/exfat-utils/) is [needed for mounting exfat formatted drives](https://andreas.scherbaum.la/post/2024-08-12_arch-linux-mount-unknown-filesystem-type-exfat/),
but it conflicts with `exfatprogs`
......@@ -4,19 +4,27 @@
<https://security.stackexchange.com/a/144044>
```sh
ssh-keygen -a 100 -t ed25519 -f ./id_ed25519
```
## Disable pubkey auth
```sh
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no localhost
```
## Force certain identity file
```sh
ssh -o IdentitiesOnly=yes -i id_ed25519 bitrigger -v
```
## Deploy pubkey
```sh
ssh-copy-id -i keydir/work.pub server
```
## SSH into old boxes
......@@ -24,24 +32,32 @@
When the remote host shows this:
```sh
ssh 10.27.13.130
Unable to negotiate with 10.27.13.130 port 22: no matching key exchange method
found. Their offer:
diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,kexguess2@matt.ucc.asn.au
```
Use:
```sh
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1
```
## SSH-Agent
Start ssh-agent if none is running:
```sh
eval $(ssh-agent)
```
Then add keys:
```sh
ssh-add /root/.ssh/work_rsa
```
## GPG as ssh-agent
......@@ -49,30 +65,38 @@ Key-DB: `~/.gnupg/sshcontrol`
Show keys added to gpg ssh-agent:
```sh
ssh-add -E md5 -l
echo 'KEYINFO --ssh-list --ssh-fpr' | gpg-connect-agent
cat ~/.gnupg/sshcontrol
```
### Remove ssh-key from agent
<https://lists.gnupg.org/pipermail/gnupg-users/2016-August/056499.html>
```sh
ssh-add -E md5 -l
gpg-connect-agent
KEYINFO --ssh-list --ssh-fpr
DELETE_KEY <key_id>
```
## SSH-Tunnel
Create tunnel:
```sh
ssh -L 8080:192.168.9.5:80 server
```
## Socks proxy tunnel
```sh
ssh -D 1080 kermit
```
Then configure browser proxy settings as socks proxy: `localhost:1080`
......@@ -80,20 +104,26 @@ Then configure browser proxy settings as socks proxy: `localhost:1080`
## in file
```sh
ssh-keygen -lf /etc/ssh/ssh_known_hosts
ssh-keygen -lf ~/.ssh/known_hosts -E md5 -F '[server1.example.org]:22'
ssh-keygen -E sha256 -lf <(ssh-keyscan -t ecdsa 10.1.1.12 2>/dev/null)
256 SHA256:0N6VUnfoJyfkgaRCAkSOWOp0WB6/au5LbrQ0x9FUm44 10.1.1.12 (ECDSA)
```
## DSH
```sh
dsh -cM -g bm.couch "grep '\[error\]' /opt/bigcouch/var/log/bigcouch.log|wc -l"
```
## endlessh - SSH tarpit
<https://nullprogram.com/blog/2019/03/22/>
<https://github.com/skeeto/endlessh>
```sh
docker container run --rm --name endlessh -p 2222:2222 harshavardhanj/endlessh
ssh -v localhost -p 2222
```
......@@ -4,5 +4,17 @@ See also [../smart-meter.md](../smart-meter.md) for reading smart meters.
## Appliance detection
- [Detect and monitor the state of an appliance based on its power consumption](https://community.home-assistant.io/t/detect-and-monitor-the-state-of-an-appliance-based-on-its-power-consumption-v2-1-1-updated/421670)
- [Best way to detect a pattern in a power sensor?](https://community.home-assistant.io/t/best-way-to-detect-a-pattern-in-a-power-sensor/546125)
- [Blueprint: Detect and monitor the state of an appliance based on its power consumption](https://community.home-assistant.io/t/detect-and-monitor-the-state-of-an-appliance-based-on-its-power-consumption-v2-1-1-updated/421670)
- [leofabri/hassio_appliance-status-monitor](https://github.com/leofabri/hassio_appliance-status-monitor)
- Outdates, last commit 2022
### AI / ML based
- [AI Power Consumption](https://community.home-assistant.io/t/ai-power-consumption/389064/4)
- [FR: Machine learning device states from power meter parameters](https://community.home-assistant.io/t/machine-learning-device-states-from-power-meter-parameters/818178)
- [Energy Disaggregation or Non-Intrusive Load Monitoring (NILM) blueprint](https://community.home-assistant.io/t/energy-disaggregation-or-non-intrusive-load-monitoring-nilm-blueprint/619672)
- [Development of an Open Source Energy
Disaggregation Tool for the Home Automation
Platform Home Assistant](https://htwk-leipzig.qucosa.de/api/qucosa%3A83837/attachment/ATT-0/)
- [Source code](https://git.fh-aachen.de/energy-disaggregation-tool)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment