The API wasn't really designed to work outside of the context of the
ansible CLI utilities (or at least that wasn't a primary concern).  As
such, TaskQueueManager expects you to pass in something that works like an
optparse options object.

The example uses a named tuple, as that is easiest.  The items in that
documentation for namedtuple are the minimum required to satisfy the API.
Any settings outside of what is mentioned in that namedtuple can be passed
via other means.

Since you have mentioned you use extra_vars to pass in things like
connection, you would just need to mimic the defaults of the options in
optparse for the ansible clis.  extra_vars would then override it.

So something like:

options = Options(connection='ssh', ...)
extra_vars = dict(ansible_connection=winrm, ...)

Hope that makes sense, basically you have to give an options that satisfies
the API (What the code is expecting).  If you override via extra_vars, then
so be it, but you still need to supply, even if different, those options in
the options namedtuple.

On Mon, Jun 13, 2016 at 1:51 PM, Fran Fitzpatrick <
[email protected]> wrote:

> Thanks, Brian.
>
> So right now I'm essentially following this guide:
> http://docs.ansible.com/ansible/developing_api.html
>
> Since we have all of our configuration options being passed in as
> variables, I essentially do `variable_manager.extra_args = our_extra_args`
> ... since I have that, I'm not sure why I need to create an Options tuple
> and pass it into the TaskQueueManager? Then it seems like I would need to
> do, for example: options.connect = out_extra_args['ansible_connection']?
>
> I feel like I'm missing something here.
>
> Fran
>
> On Mon, Jun 13, 2016 at 1:04 PM Brian Coca <[email protected]> wrote:
>
>> They are complementary, the Options tuple is simulating 'command line
>> options', which still get overridden by connection variables.
>>
>>
>> ----------
>> Brian Coca
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to