From ebbd80aa1316b32a1584d7a844b1dc3d9d87fcb7 Mon Sep 17 00:00:00 2001 From: World's Tallest Ladder Date: Thu, 24 Apr 2025 10:33:29 -0700 Subject: [PATCH] allow arbitrary limits for run script --- README.md | 10 +++++++--- run.zsh | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 47bd873..a01d944 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/run.zsh b/run.zsh index ad63aa8..b645a89 100755 --- a/run.zsh +++ b/run.zsh @@ -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"