there is a problem to this ....
if my hostvars declared esx_host and under that the host is lets say
10.16.1.3 then self.play.hosts gives esx_host and not 10.16.1.3
runner_on_ok gets the right host as a parameter
So back to finding a good way ! I am using ansible 1.0 and alos using the
adaptors as recommended
def v2_playbook_on_task_start(self, task, is_conditional):
self.task = task
self.playbook_on_task_start(task, is_conditional)
On Monday, April 25, 2016 at 7:38:35 PM UTC-7, Ritesh Shetty wrote:
>
> play.hosts works !
>
> On Monday, April 25, 2016 at 1:17:16 PM UTC-7, Ritesh Shetty wrote:
>>
>> I used to have this code in ansible 1.x
>>
>> def playbook_on_task_start(self, name, is_conditional):
>>
>> play = getattr(self, 'play', None)
>> task = getattr(self, 'task', None)
>>
>> if play is not None and task is not None:
>> for host in play._play_hosts:
>> print host
>>
>>
>>
>> But with ansible 2.0 looks like its all changed. My aim is to get list of
>> hosts when task starts for auditing purposes
>>
>> Can some one please help !
>>
>>
>>
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5d342762-7635-4c96-bc47-7e3de753c694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.