我正在使用hosts静态库存文件:
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
Run Code Online (Sandbox Code Playgroud)
而且我有一个example.yml像这样的剧本:
---
- name: base setup
become: true
hosts:
- group1
roles:
- base
Run Code Online (Sandbox Code Playgroud)
我想ansible-playbook使用测试运行example.yml,但仅针对主机server1.有办法做到这一点吗?
Son*_*ton 15
好吧,我写完了这个问题,然后我的SO搜索功能得到了改进.以下是一些答案:
使用-l SUBSET:
使用-i "hostname,":