]> git.phdru.name Git - ansible.git/commitdiff
Refactor(cleanup-tmp.sh): Use `ansible --list-hosts` instead of `run-hosts -L`
authorOleg Broytman <phd@phdru.name>
Tue, 3 May 2022 22:15:12 +0000 (01:15 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 3 May 2022 22:15:12 +0000 (01:15 +0300)
playbooks/ansible/cleanup-tmp.sh

index af8ba206348225a7cb1a6c53f06075fcddeabe17..1fdefca184e7ae7e197c667425f74bf2f1d4bc8c 100755 (executable)
@@ -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