I’ve recently discovered with_inventory_hostnames, which seems like exactly what I need, but --limit doesn’t seem to affect it. A quick look at the code seems to tell me that it should work, but I’m not 100% sure. I’m using it in a play like this:
-
name: Deploy
hosts: source_server
tasks: -
name: Copy files to servers
command: rsync -az /files/ {{ item }}:/files
with_inventory_hostnames: target_servers
In this case, target_servers is a group that contains 10.5.4.3 and 10.5.4.4. I run ansible-playbook with --limit 10.5.4.3, and the task runs for 10.5.4.4 as well. I’m using a recent ansible dev version (afa781d). Any ideas? Am I missing something? Thanks,
Nathan