Question:
I’m using a hosts
file for static inventory:
1 2 3 4 5 6 7 8 |
server1 ansible_ssh_host=1.1.1.1 server2 ansible_ssh_host=1.1.1.2 server3 ansible_ssh_host=1.1.1.3 [group1] server1 server2 |
And I’ve got a playbook example.yml
like this:
1 2 3 4 5 6 7 8 |
--- - name: base setup become: true hosts: - group1 roles: - base |
I’d like to an ansible-playbook
test run using example.yml
, but only against the host server1. Is there a way of doing this?
Answer:
Well I finished writing this question, then my SO search-fu improved. Here are some answers:
Using -l SUBSET
:
Using -i "hostname,"
: