From: Oleg Broytman Date: Tue, 3 May 2022 22:15:12 +0000 (+0300) Subject: Refactor(cleanup-tmp.sh): Use `ansible --list-hosts` instead of `run-hosts -L` X-Git-Url: https://git.phdru.name/?p=ansible.git;a=commitdiff_plain;h=a7b70bd8c58a88c2b88af34314db11a8e2f14de9 Refactor(cleanup-tmp.sh): Use `ansible --list-hosts` instead of `run-hosts -L` --- diff --git a/playbooks/ansible/cleanup-tmp.sh b/playbooks/ansible/cleanup-tmp.sh index af8ba20..1fdefca 100755 --- a/playbooks/ansible/cleanup-tmp.sh +++ b/playbooks/ansible/cleanup-tmp.sh @@ -1,9 +1,11 @@ #! /bin/sh +hosts="`\"$HOME\"/.virtualenvs/ansible/bin/ansible --list-hosts servers | tail -n +2`" + echo localhost rm -rf "$HOME"/.ansible/tmp/\* -for host in `run-hosts -L`; do +for host in $hosts; do echo $host ssh $host exec rm -rf .ansible/tmp/\* done