Initial Ansible scenarios
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# Ansible scenarios
|
||||
|
||||
Inventory is stored in `inventory/hosts.yml`. Each host has a name; the first
|
||||
one is `localhost`. Each scenario is a separate file in `scenarios/`.
|
||||
|
||||
`inventory/hosts.yml` and `inventory/credentials.yml` are local files and are
|
||||
not committed to Git. Use the matching `*.example.yml` files as templates.
|
||||
|
||||
Run one scenario on one host:
|
||||
|
||||
```bash
|
||||
./ansible localhost update
|
||||
```
|
||||
|
||||
The first argument selects the host or host group, and the second selects one
|
||||
or more scenarios. For example, after adding a `backup` scenario:
|
||||
|
||||
```bash
|
||||
./ansible localhost update,backup
|
||||
```
|
||||
|
||||
The full Ansible command remains available when required:
|
||||
|
||||
```bash
|
||||
ansible-playbook playbooks/site.yml --limit localhost --tags update
|
||||
```
|
||||
|
||||
The `update` scenario updates all installed system packages. The `reboot`
|
||||
scenario restarts the selected host. The `soft` scenario installs common
|
||||
utilities. The `docker-pull` scenario updates only running Compose projects:
|
||||
it pulls their images and recreates containers when an image has changed. Add
|
||||
new hosts to `inventory/hosts.yml` and new scenarios to `scenarios/`, then
|
||||
import each new scenario into `playbooks/site.yml` with its own tag.
|
||||
Reference in New Issue
Block a user