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?
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.
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.
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.
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 .
Same way as you would do for hosts : -l PerfSetup
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