Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running an Ansible playbook against a single host

Tags:

ansible

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?

like image 983
Sonia Hamilton Avatar asked Feb 11 '16 06:02

Sonia Hamilton


1 Answers

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?

like image 164
Sonia Hamilton Avatar answered Oct 08 '22 21:10

Sonia Hamilton