allow arbitrary limits for run script
parent
267205df8c
commit
ebbd80aa13
10
README.md
10
README.md
|
@ -22,8 +22,9 @@ Optional requriements where configuration is installed for:
|
||||||
- [vim](https://www.vim.org/)
|
- [vim](https://www.vim.org/)
|
||||||
- [zsh](https://www.zsh.org/)
|
- [zsh](https://www.zsh.org/)
|
||||||
|
|
||||||
An inventory file at `~/.config/ansible/hosts` with an entry for a host
|
An inventory file at `~/.config/ansible/hosts`. By default this will look for an
|
||||||
`webhost`. This may be a group if you want to target multiple hosts.
|
entry for a host or group `webhost`, but you can pass any argument to the
|
||||||
|
script to limit it.
|
||||||
|
|
||||||
Your machine requires the following:
|
Your machine requires the following:
|
||||||
|
|
||||||
|
@ -42,5 +43,8 @@ ansible-galaxy collection install -r requirements.yaml
|
||||||
Run via the following:
|
Run via the following:
|
||||||
|
|
||||||
```zsh
|
```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.
|
||||||
|
|
6
run.zsh
6
run.zsh
|
@ -1,9 +1,13 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
local DIR="${0:a:h}"
|
local DIR="${0:a:h}"
|
||||||
|
local LIMIT="webhost"
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
LIMIT="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
ansible-playbook \
|
ansible-playbook \
|
||||||
--ask-vault-pass \
|
--ask-vault-pass \
|
||||||
--inventory-file "$HOME/.config/ansible/hosts" \
|
--inventory-file "$HOME/.config/ansible/hosts" \
|
||||||
--limit "webhost" \
|
--limit "$LIMIT" \
|
||||||
"$DIR/playbook.yaml"
|
"$DIR/playbook.yaml"
|
||||||
|
|
Loading…
Reference in New Issue