Scenario
I have a group A
in my inventory, where A
contains a1,a2,a3
hosts. It does mean that I can write in my playbook X.yml
:
- hosts: A
roles:
- role:
name: r
The problem is about playbook X
is started with limited number of hosts, namely launch of ansible-playbook X
is limited to host a1
. This playbook X
invoke role r
(which is executed on host a1
). I wouldn't like to change this behaviour (in other words I would like to preserve this limitation, don't ask why please).
Question
Is it possible to write task in role r
in such way that it will be executed on all hosts from group A
even if playbook is limited to host a1
? Please keep in mind that my inventory contains group A
.
If not, could you suggest me another approach?
The one that I can do is:
- hosts: A
tasks:
- name: "This task"
--limit
, I don't think you can get it to execute on any hosts that are not part of the current limit configuration. – larsks