lazy evaluation - Ansible raw module: compare local time with target nodes time -
lazy evaluation - Ansible raw module: compare local time with target nodes time -
all target machine android , not have python
so wanna know each machine's time compared local time.
ansible -m raw -a "echo $(date +%s); date +%s"
does not work, since $(date +%s)
evaluated since origin of execution, , there many nodes executes much later.
is there way delay evaluation?
imho using simple ssh easier ansible purpose.
if want go on using ansible check out the --forks|-f
option if have 100 androids talk then:
ansible -f 100 -m raw -a "echo $(date +%s); date +%s"
or old ssh:
for h in `ansible -i inventory.ini --list-hosts`; d=`date +%s`; ssh $h "echo \$hostname - $(date +%s) - $d" & done
time lazy-evaluation ansible delayed-execution
Comments
Post a Comment