ansible/pytest-ansible

run module with its own variable

lguohan opened this issue · 2 comments

I'd like to run following task, how can i achieve using pytest?

- name: Gather information from LLDP
  lldp:
  vars:
    ansible_shell_type: docker
    ansible_python_interpreter: docker exec -i lldp python

Hi @lguohan ... there are a few examples in the README that might help find a path forward. For example, you might try ...

ansible_adhoc(inventory='localhost,', connection='docker').localhost.lldp()

I suspect you'll have to experiment and report back if something doesn't work. Particularly, the python_interpreter or shell_type may not be tunable without some minor changes.

docker connection does not work for me, my docker is on a remote host. I like to run lldp module on the docker that is in remote host.