ansible.runner ask-pass?

Hi Everyone,

I’m attempting to use the ansible api to query a bunch of servers (programmatically) .

I’m running into an issue where all of my servers require a MFA-authentication+passcode.

Is there a way I can have my python/ansible script prompt me for the password?
Obviously in a playbook or commandline call I can do an --ask-pass; however I need to leverage python for a bunch of
‘other’ processing tasks.

I’m using this basic code as a starter: (lifted from the ansible api docs/examples)

ansible_hosts

`

[testservers]
vmdsxwo83
vmdsxwo84
vmdsxwo85
vmdsxwo86
vmdsxwo87

`

test.py

`
#!/usr/local/bin/python

import ansible.runner

runner = ansible.runner.Runner(
module_name=‘command’,
module_args=‘uptime’,
pattern=‘testservers’,
forks=10
)

datastructure = runner.run()
print datastructure

`

Thanks.

–mike