I'm using a hosts
file for static inventory:
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:
---
- 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?
Well I finished writing this question, then my SO search-fu improved. Here are some answers:
Using -l SUBSET
:
Running an Ansible Playbook on a particular group of servers
Using -i "hostname,"
:
How do I narrow down scope when running an ansible playbook?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With