I’ve been struggling with passing variable to serial for the whole day.
All I need is to pass group’s length, I’ve tried
serial: "{{ groups['appserver']|length }}"
and got a runtime error.
Finally I come up with this code:
serial: "{{ lookup('group_size', 'appserver') }}"
, where group_size is a custom lookup plugin.
Now I have another problem - how can I get access to inventory instance inside lookup plugin? I don’t understand API design - all plugins have “runner” instance in constructor except LookupModule.
So my questions are:
- can I parameterize serial?
- can I access inventory inside LookupModule?
Thank you!