Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running an Ansible Playbook on a particular group of servers

I have the following /etc/ansible/hosts:

[ESNodes] isk-vsrv643 isk-vsrv644 isk-vsrv645  [PerfSetup] isk-dsrv613 isk-dsrv614 

I know there is an option to run a playbook on particular hosts with -l Is there a way to run a playbook only on the PerfSetup group?

like image 991
isaac.hazan Avatar asked Mar 02 '14 15:03

isaac.hazan


People also ask

Which option would target a playbook to run only on certain hosts?

Ansible command limit option Using the --limit parameter of the ansible-playbook command is the easiest option to limit the execution of the code to only one host. The advantage is that you don't need to edit the Ansible Playbook code before executing to only one host.

How do I limit Ansible hosts?

You can also limit the hosts you target on a particular run with the --limit flag. Negated limit. Note that single quotes MUST be used to prevent bash interpolation.

How do I run multiple Ansible playbooks at once?

you can run more playbooks using "ansible-playbook [OPTIONS] *. yml" command. This will execute all the playbooks NOT IN PARALLEL WAY, but in serial way, so first one playbook and after the execution, another playbook. This command can be helpful if you have many playbooks.

How do I run a specific part of my playbook in Ansible?

The easiest way to run only one task in Ansible Playbook is using the tags statement parameter of the “ansible-playbook” command. The default behavior is to execute all the tags in your Playbook with --tags all .


1 Answers

Same way as you would do for hosts : -l PerfSetup

like image 146
leucos Avatar answered Sep 20 '22 04:09

leucos