allow arbitrary limits for run script

main
World's Tallest Ladder 2025-04-24 10:33:29 -07:00
parent 267205df8c
commit ebbd80aa13
Signed by: wtl
GPG Key ID: F0D4D5526213099D
2 changed files with 12 additions and 4 deletions

View File

@ -22,8 +22,9 @@ Optional requriements where configuration is installed for:
- [vim](https://www.vim.org/)
- [zsh](https://www.zsh.org/)
An inventory file at `~/.config/ansible/hosts` with an entry for a host
`webhost`. This may be a group if you want to target multiple hosts.
An inventory file at `~/.config/ansible/hosts`. By default this will look for an
entry for a host or group `webhost`, but you can pass any argument to the
script to limit it.
Your machine requires the following:
@ -42,5 +43,8 @@ ansible-galaxy collection install -r requirements.yaml
Run via the following:
```zsh
./run.zsh
./run.zsh [limit]
```
Where `limit` is the limit, will default to `webhost` but any valid argument to
`ansible-playbook --limit` will work.

View File

@ -1,9 +1,13 @@
#!/usr/bin/env zsh
local DIR="${0:a:h}"
local LIMIT="webhost"
if [[ -n "$1" ]]; then
LIMIT="$1"
fi
ansible-playbook \
--ask-vault-pass \
--inventory-file "$HOME/.config/ansible/hosts" \
--limit "webhost" \
--limit "$LIMIT" \
"$DIR/playbook.yaml"