GPT-OSS additions

This commit is contained in:
2026-03-24 16:13:33 +02:00
parent 3dfbb61273
commit 256e32eeaa
4 changed files with 155 additions and 82 deletions

View File

@@ -1,11 +1,20 @@
## Ad-Hoc Commands
# Adhoc Commands
**Problem** “I need to run a quick check or command on a host without writing a full playbook.”
**Solution** Use the `ansible` command with the `-m` (module) option.
| Usecase | Command | What it does |
|----------|---------|--------------|
| Ping a host | `ansible host1 -m ping` | Verifies connectivity. |
| List services | `ansible host1 -m shell -a 'systemctl list-units --type=service'` | Executes a shell command. |
| Gather facts | `ansible all -m setup` | Collects system information. |
| Run playbook file only | `ansible-playbook site.yml` | Executes the full playbook. |
**Example Quick package check**
```bash
ansible all -m ping
ansible all -m command -a "uptime"
ansible webserver -m apt -a "name=vim state=present"
ansible web2 -m yum -a "name=nginx state=latest"
```
Ansible is ideal for orchestrating infrastructure as code across cloud, on-premise, and hybrid environments.
---
> **Tip** Add `-vv` for verbose output to see command execution details.