FreeKB - ansible-playbook - limiting target servers
ansible-playbook - limiting target servers

Home > Search


This assumes you have installed Ansible Tower and are familiar with the ansible-playbook command.

The -l or --limit= options can be used to limit a task to be performed against certain target servers.  For example, let's say your inventory.yml file that contains the target hosts contains the following.

all:
  children:
    windows:
      hosts:
        server1.example.com:
        server2.example.com:
    linux:
      hosts:
        server3.example.com:
        server4.example.com:

 

In this example, the following command could be used to target only server1.example.com.

ansible-playbook playbook.yml -i inventory.yml --limit=server1.example.com

 

play_hosts can be used to store the server in a variable.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 18493 in the box below so that we can be sure you are a human.




Comments