ansible-playbook don't see the custom connection plugin

17 views
Skip to first unread message

Valentin Gusarin

unread,
Oct 23, 2020, 7:49:27 AM10/23/20
to Ansible Development
Hi!

I try to develope custom connection plugin. Plugin placed in ~/.ansible/plugins/connection folder and correctly seen by ansible-doc.
But, when I try to run playbook, I have a message:
{"msg": "the connection plugin 'packetlogic' was not found"}

I tryed to research the reason. But found only that error happened hear:
class Connection(ConnectionBase): def __init__(self, play_context, new_stdin, *args, **kwargs): super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)

When I made systax error in class Connection (fo test), I saw followin trace:


The full traceback is:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 158, in run

    res = self._execute()

  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 613, in _execute

    self._connection = self._get_connection(cvars, templar)

  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 913, in _get_connection

    ansible_playbook_pid=to_text(os.getppid())

  File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line 800, in get_with_context

    self._module_cache[path] = self._load_module_source(name, path)

  File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line 769, in _load_module_source

    module = imp.load_source(to_native(full_name), to_native(path), module_file)

  File "/home/veg/.ansible/plugins/connection/packetlogic.py", line 163

    def _connect(self):

      ^

IndentationError: expected an indented block

fatal: [pre01.mos1]: FAILED! => {

    "msg": "Unexpected failure during module execution.",

    "stdout": ""

}


Can anyone helps me with this, pls? 


Reply all
Reply to author
Forward
0 new messages