Giter Club home page Giter Club logo

ansible-sshjail's People

Contributors

austinhyde avatar bigj64 avatar dch avatar grembo avatar infiniverse avatar kupyxa avatar madpilot78 avatar msafadieh avatar overhacked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-sshjail's Issues

UnboundLocalError: local variable 'copycmd' referenced before assignment

I'm trying the ansible-sshjail connection plugin against ansible 2.3 (with the dev_ansible_v2 branch).

I'm using 'jail-me' on the jail host.

When I try to run a simple command I get an error which appears to be code not environment.

joe:ansible-plays joe$ ansible -vvv -i inventory/devel/inventory all --limit=foo -m command -a pwd
No config file found; using defaults
META: ran handlers
Using module file /Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/modules/commands/command.py
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 'which -s jailme'
<10.17.0.2> (0, '', 'Shared connection to 10.17.0.2 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 'jls -q jid name host.hostname path'
<10.17.0.2> (0, '1 ioc-94ea63de-1ee7-11e7-b2a8-080027ca2b91 foo /iocage/jails/94ea63de-1ee7-11e7-b2a8-080027ca2b91/root\r\n2 ioc-c5957792-1e72-11e7-ac07-080027ca2b91 asterisk-customer2 /iocage/jails/c5957792-1e72-11e7-ac07-080027ca2b91/root\r\n', 'Shared connection to 10.17.0.2 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 'jailme 1 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'echo ~'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<10.17.0.2> (0, '/home/joe\r\n', 'Shared connection to 10.17.0.2 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 'jailme 1 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo /home/joe/.ansible/tmp/ansible-tmp-1492681710.9-55117835483012 `" && echo ansible-tmp-1492681710.9-55117835483012="` echo /home/joe/.ansible/tmp/ansible-tmp-1492681710.9-55117835483012 `" )'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<10.17.0.2> (0, 'ansible-tmp-1492681710.9-55117835483012=/home/joe/.ansible/tmp/ansible-tmp-1492681710.9-55117835483012\r\n', 'Shared connection to 10.17.0.2 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 mktemp
<10.17.0.2> (0, '/tmp/tmp.LXrU8SDe\r\n', 'Shared connection to 10.17.0.2 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: None
<10.17.0.2> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f -tt 10.17.0.2 'chmod 0644 /tmp/tmp.LXrU8SDe'
<10.17.0.2> (0, '', 'Shared connection to 10.17.0.2 closed.\r\n')
<10.17.0.2> PUT /var/folders/p4/rjqvjlbx2rz1cs9x74f0tb6m0000gp/T/tmpQ5tjGA TO /tmp/tmp.LXrU8SDe
<10.17.0.2> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/joe/.ansible/cp/367f5a9c1f '[10.17.0.2]'
<10.17.0.2> (0, 'sftp> put /var/folders/p4/rjqvjlbx2rz1cs9x74f0tb6m0000gp/T/tmpQ5tjGA /tmp/tmp.LXrU8SDe\n', '')
<[email protected]> REMOTE COPY /tmp/tmp.LXrU8SDe TO /iocage/jails/94ea63de-1ee7-11e7-b2a8-080027ca2b91/root/home/joe/.ansible/tmp/ansible-tmp-1492681710.9-55117835483012/command.py
The full traceback is:
Traceback (most recent call last):
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/executor/task_executor.py", line 125, in run
    res = self._execute()
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/executor/task_executor.py", line 521, in _execute
    result = self._handler.run(task_vars=variables)
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/plugins/action/normal.py", line 45, in run
    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars, wrap_async=wrap_async))
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/plugins/action/__init__.py", line 658, in _execute_module
    self._transfer_data(remote_module_path, module_data)
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/plugins/action/__init__.py", line 342, in _transfer_data
    self._transfer_file(afile, remote_path)
  File "/Users/joe/Documents/TrueSpeed/repositories/ansible/lib/ansible/plugins/action/__init__.py", line 319, in _transfer_file
    self._connection.put_file(local_path, remote_path)
  File "/Users/joe/Documents/TrueSpeed/repositories/true-services-dev/ansible-plays/connection_plugins/sshjail.py", line 170, in put_file
    self._copy_file(tmp, out_path)
  File "/Users/joe/Documents/TrueSpeed/repositories/true-services-dev/ansible-plays/connection_plugins/sshjail.py", line 143, in _copy_file
    code, stdout, stderr = self._jailhost_command(copycmd)
UnboundLocalError: local variable 'copycmd' referenced before assignment

foo | FAILED | rc=-1 >>
Unexpected failure during module execution.

Upload file works

You wrote "Fetching files hasn't been tested yet. It may not work.". Just wanted to say I tried the template plugin and it works! It's only needed to change the ansible remote_tmp variable to something like remote_tmp=/tmp/.ansible

Cool software, thank you, very very helpful!

breaking change in ansible 2.12.3 - connecting to myjail@host instead of host

I'm not using sshjail, but I'm using sshlxd which started as a fork and I think this problem applies to both.

Ansible 2.12.3 includes this pull request which overwrites self.host in a bunch of places. This means that ansible will try to ssh into myjail@address (and fail) instead of just connecting to address.

My fix for this was to add a self.set_option('host', self.host) in exec_command:

def exec_command(self, cmd, in_data=None, executable='/bin/sh', sudoable=True):
    ''' run a command in the container '''

    self.set_option('host', self.host)
    cmd = '%s exec %s -- %s' % (self.get_container_connector(), self.get_container_id(), cmd)

    return super(Connection, self).exec_command(cmd, in_data, True)

Exceptions after upgrading to ansible 4.x

Hi,

I'm posting this more as a "knowledge base entry" than anything else, because I managed to get everything working again. I hope it helps someone who gets stuck in the same situation (I propose to close it after both issues are addressed sshjail's code).

I've been very lazy with upgrading, so after finally switching to ansible 4.x, I hit two bumps. Note that I didn't change any configuration or ansible data though.

First one:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'Requested entry (plugin_type: connection plugin: sshjail setting: timeout ) was not defined in configuration.'
fatal: [...]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}

As it turns out, this issue is already fixed in #32. I used that fork and the error was gone...

... leading me to the second one:

  File "[...]/plugins/connection/sshjail.py", line 449, in _copy_file
    copycmd = plugin.build_become_command(' '.join(['cp', from_file, to_file]), shell)
AttributeError: 'NoneType' object has no attribute 'build_become_command'
fatal: [...]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

This issue is already addressed in #30. I'm in the same situation: Ansible sshs to root@jailhost so never needed any become in the first place. It would be cool if this worked like before, but the workaround of configuring become=true, become_method=su (as documented in readme) helped.

That's all.

And thanks a lot for this wonderful plugin. It keeps my jail frankenstein zoo alive! :-)

Unexpected error when connecting with invalid user

Found this while trying to connect to a vagrant virtual machine, without specifying an ansible_ssh_user:

$ ansible -i inventory/vagrant influx -m command -a hostname -k -vvvv
SSH password: 
<127.0.0.1> ESTABLISH CONNECTION FOR USER: austin.hyde
<[email protected]> REMOTE_MODULE command hostname
<127.0.0.1> EXEC sshpass -d6 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/austin.hyde/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=2222 -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o ConnectTimeout=10 127.0.0.1 /bin/sh -c 'jls -q jid name host.hostname path'
JLS stdout:
influx00 | FAILED => jls returned non-zero!

Need to make it output a more sensible error message if possible.

[dev_ansible_v2] IndexError: list index out of range in _strip_sudo

Hi,

I'm testing the latest dev_ansible_v2 with either vanilla ansible 2.0.1.0 or your patched version, and I get:

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ansible/executor/task_executor.py", line 120, in run
    res = self._execute()
  File "/usr/lib/pymodules/python2.7/ansible/executor/task_executor.py", line 418, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/pymodules/python2.7/ansible/plugins/action/normal.py", line 33, in run
    results = merge_hash(results, self._execute_module(tmp=tmp, task_vars=task_vars))
  File "/usr/lib/pymodules/python2.7/ansible/plugins/action/__init__.py", line 459, in _execute_module
    res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data)
  File "/usr/lib/pymodules/python2.7/ansible/plugins/action/__init__.py", line 520, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/home/user/Documents/ansible/connection_plugins/sshjail.py", line 104, in exec_command
    cmd = self._strip_sudo(executable, cmd)
  File "/home/user/Documents/ansible/connection_plugins/sshjail.py", line 94, in _strip_sudo
    cmd = cmd.split('; ', 1)[1]
IndexError: list index out of range

I inserted a noobish "print(cmd)/print(executable)" into the function to dump call parameters and be able to reproduce it in bpython:

>>> cmd = '/bin/sh -c \'sudo -H -S -n -u root /bin/sh -c \'"\'"\'echo BECOME-SUCCESS-fqfhllpqznhajqrrquoecntwwseonzez; /bin/sh -c \'"\'"\'"\'"\'"\'"\'"\'"\'LAN
G=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 /usr/local/bin/python /root/.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/ping; rm -rf "/root/
.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/" > /dev/null 2>&1\'"\'"\'"\'"\'"\'"\'"\'"\'\'"\'"\'\''
>>> executable='/bin/sh'
>>> sudoless = cmd.rsplit(executable + ' -c ', 1)[1]
>>> print(sudoless)
'"'"'"'"'"'"'"'"'LANG=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 /usr/local/bin/python /root/.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/
ping; rm -rf "/root/.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
>>> quotes = sudoless.partition('echo')[0]
>>> print(quotes)
'"'"'"'"'"'"'"'"'LANG=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 /usr/local/bin/python /root/.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/
ping; rm -rf "/root/.ansible/tmp/ansible-tmp-1458059451.03-12134202492962/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
>>> cmd = sudoless[len(quotes):-len(quotes+'?')]
>>> print(cmd)

>>> cmd = cmd.split('; ', 1)[1]
Traceback (most recent call last):
  File "<input>", line 1, in <module>
IndexError: list index out of range

Support for Python 3

The software does not work with Python 3, a byte / string conversion error occurs.

Quotes & strip: can't open file <temporary remote script.py>

Hello, quotes nightmare seems to be back (#12). So like before I deployed my very best dev skills by calling print() ^^.
cmd strip show the returned value of _strip_sudo() and cmd exec the value in exec_command() right after the composition of the final command (if I get this corectly: cmd = ' '.join([executable, '-c', pipes.quote(cmd)]))
I use python 2.7.14 and ansible v2.5.6 and v2.6.1 give the same output:

$ ansible jail -i inventory -m ping -v

cmd exec: /bin/sh -c '/bin/sh -c '"'"'echo ~igor'"'"''
cmd exec: /bin/sh -c '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo ~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424 `" && echo ansible-tmp-1533806098.24-152749480273424="` echo ~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424 `" )'"'"''
cmd exec: /bin/sh -c '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/ping.py'"'"'"'"'"'"'"'"''"'"''
cmd strip: /usr/local/bin/python '"'"'"'"'"'"'"'"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/ping.py'"'"'"'"'"'"'"'"'
cmd exec: /bin/sh -c '/usr/local/bin/python '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/ping.py'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"''
cmd exec: /bin/sh -c '/bin/sh -c '"'"'rm -f -r '"'"'"'"'"'"'"'"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/'"'"'"'"'"'"'"'"' > /dev/null 2>&1'"'"''

jail | FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to 127.0.0.1 closed.\r\n",
    "module_stdout": "/usr/local/bin/python: can't open file '\"'\"'\"'~igor/.ansible/tmp/ansible-tmp-1533806098.24-152749480273424/ping.py'\"'\"'\"': [Errno 2] No such file or directory\r\n",
    "msg": "MODULE FAILURE",
    "rc": 2
}

Igor is my become_user here and sudo is enabled. It seems to confirm than a lot of uninvited double-quotes have join the party around the name of the temporary python script on remote hosts.

What do you think?

become password per host

I have ansible_become_pass saved in an ansible vault under
host_vars/freebsdhost
which makes normal ansible playbooks run fine bs. that host.

If I run it against a jail, ansible thinks the hostname is jail@hostname, and thus looks for a
host_vars/jail@freebshost file.

I am currently solving that by creating a symlink per jail in the host_vars/ directory, but this seems very inefficient.

Is there a better way to do this? Can ansible be convinced to read the settings for the base host?

Quote removal off-by-one (on ansible core 2.11.2)

Changing this line

cmd = sudoless[len(quotes):-len(quotes+'?')]

to

    cmd = sudoless[len(quotes):-len(quotes)] 
    if cmd.endswith("'"):
        cmd = cmd[:-1]

fixes the issue (even if it's just a workaround).

Example playbook that fails without the patch:

---
- hosts: all
  gather_facts: False
  
  tasks:
   - name: install python
     raw: test -e /usr/local/bin/python || ( pkg install -y python )

Fix for Ansible 2.5

Just FYI Ansible 2.5 will die without DOCUMENTATION string from the original ssh plugin. I think it validates the options from the string now.

Unexpected failure during module execution

The plugin crashes when I try to execute the following task:

- name: Test
  command: "touch /Testolope.dat"
  connection: sshjail
  delegate_to: "{{ jail_name }}@{{ inventory_hostname }}"

(jail_name is defined and the jail is running; jexec works)

Playbook:

- hosts: all
  any_errors_fatal: true
  remote_user: root
  
  vars:
    - jail_name: playground

  tasks:
    - name: Test
      command: "touch /Testolope.dat"
      connection: sshjail
      delegate_to: "{{ jail_name }}@{{ inventory_hostname }}"

Traceback:

The full traceback is:
Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 663, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/command.py", line 26, in run
    results = merge_hash(results, self._execute_module(module_name='ansible.legacy.command', task_vars=task_vars, wrap_async=wrap_async))
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 888, in _execute_module
    self._transfer_data(remote_module_path, module_data)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 498, in _transfer_data
    self._transfer_file(afile, remote_path)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 475, in _transfer_file
    self._connection.put_file(local_path, remote_path)
  File "/Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible/connection_plugins/sshjail.py", line 437, in put_file
    self._copy_file(tmp, out_path)
  File "/Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible/connection_plugins/sshjail.py", line 407, in _copy_file
    copycmd = plugin.build_become_command(' '.join(['cp', from_file, to_file]), shell)
AttributeError: 'NoneType' object has no attribute 'build_become_command'

Full ansible output:

ansible-playbook 2.10.6
  config file = /Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible.cfg
  configured module search path = ['/Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible/modules']
  ansible python module location = /usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.9.2 (default, Feb 24 2021, 13:26:09) [Clang 12.0.0 (clang-1200.0.32.29)]
Using /Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible.cfg as config file
Parsed 192.168.178.83, inventory source with host_list plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: Playground.yml *****************************************************************************************************************************
1 plays in Jails.Playground/Playground.yml

PLAY [all] *******************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************
task path: /Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/Jails.Playground/Playground.yml:5
<192.168.178.83> Attempting python interpreter discovery
<192.168.178.83> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 192.168.178.83 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<192.168.178.83> (0, b'PLATFORM\nFreeBSD\nFOUND\n/usr/local/bin/python3.7\n/usr/local/bin/python\nENDFOUND\n', b'')
<192.168.178.83> Python interpreter discovery fallback (unsupported platform for extended discovery: freebsd)
Using module file /usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/modules/setup.py
Pipelining is enabled.
<192.168.178.83> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 192.168.178.83 '/bin/sh -c '"'"'/usr/local/bin/python3.7 && sleep 0'"'"''
<192.168.178.83> (0, b'\n{"ansible_facts": {"ansible_processor": ["Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (3300.00-MHz K8-class CPU)", "Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (3300.00-MHz K8-class CPU)", "Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz (3300.00-MHz K8-class CPU)"], "ansible_processor_count": "4", "ansible_memtotal_mb": 5969, "ansible_memfree_mb": 5063, "ansible_swaptotal_mb": 16384, "ansible_swapfree_mb": 16384, "ansible_bios_date": "NA", "ansible_bios_vendor": "NA", "ansible_bios_version": "NA", "ansible_board_asset_tag": "NA", "ansible_board_name": "NA", "ansible_board_serial": "NA", "ansible_board_vendor": "NA", "ansible_board_version": "NA", "ansible_chassis_asset_tag": "NA", "ansible_chassis_serial": "NA", "ansible_chassis_vendor": "NA", "ansible_chassis_version": "NA", "ansible_form_factor": "NA", "ansible_product_name": "NA", "ansible_product_serial": "NA", "ansible_product_uuid": "NA", "ansible_product_version": "NA", "ansible_system_vendor": "NA", "ansible_devices": {"cd0": [], "da0": []}, "ansible_mounts": [{"mount": "none", "device": "/dev/da0p2.eli", "fstype": "swap", "options": "sw,ealgo=AES-XTS,keylen=256"}], "ansible_hostnqn": "", "ansible_user_id": "root", "ansible_user_uid": 0, "ansible_user_gid": 0, "ansible_user_gecos": "Charlie &", "ansible_user_dir": "/root", "ansible_user_shell": "/usr/local/bin/zsh", "ansible_real_user_id": 0, "ansible_effective_user_id": 0, "ansible_real_group_id": 0, "ansible_effective_group_id": 0, "ansible_is_chroot": true, "ansible_system": "FreeBSD", "ansible_kernel": "12.2-RELEASE-p4", "ansible_kernel_version": "FreeBSD 12.2-RELEASE-p4 GENERIC", "ansible_machine": "amd64", "ansible_python_version": "3.7.9", "ansible_fqdn": "keziah-de.fritz.box", "ansible_hostname": "keziah-de", "ansible_nodename": "keziah-de", "ansible_domain": "fritz.box", "ansible_userspace_bits": "64", "ansible_architecture": "amd64", "ansible_date_time": {"year": "2021", "month": "03", "weekday": "Wednesday", "weekday_number": "3", "weeknumber": "09", "day": "03", "hour": "22", "minute": "25", "second": "41", "epoch": "1614806741", "date": "2021-03-03", "time": "22:25:41", "iso8601_micro": "2021-03-03T21:25:41.797010Z", "iso8601": "2021-03-03T21:25:41Z", "iso8601_basic": "20210303T222541797010", "iso8601_basic_short": "20210303T222541", "tz": "CET", "tz_offset": "+0100"}, "ansible_distribution": "FreeBSD", "ansible_distribution_release": "12.2-RELEASE-p4", "ansible_distribution_version": "12.2", "ansible_distribution_major_version": "12", "ansible_os_family": "FreeBSD", "ansible_selinux": {"status": "Missing selinux Python library"}, "ansible_selinux_python_present": false, "ansible_interfaces": ["bridge0", "em0", "lo0", "playground_host", "skeleton_host"], "ansible_em0": {"device": "em0", "ipv4": [{"address": "192.168.178.83", "netmask": "255.255.255.0", "network": "192.168.178.0", "broadcast": "192.168.178.255"}], "ipv6": [{"address": "fe80::20c:29ff:fe0d:6692%em0", "prefix": "64", "scope": "0x1"}, {"address": "2a02:8109:b5c0:28ac:20c:29ff:fe0d:6692", "prefix": "64"}], "type": "ether", "flags": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "macaddress": "00:0c:29:0d:66:92", "metric": "0", "mtu": "1500", "options": ["PERFORMNUD", "ACCEPT_RTADV", "AUTO_LINKLOCAL"], "media": "Ethernet", "media_select": "autoselect", "media_type": "1000baseT", "media_options": ["full-duplex"], "status": "active"}, "ansible_lo0": {"device": "lo0", "ipv4": [{"address": "127.0.0.1", "netmask": "255.0.0.0", "network": "127.0.0.0", "broadcast": "127.255.255.255"}], "ipv6": [{"address": "::1", "prefix": "128"}, {"address": "fe80::1%lo0", "prefix": "64", "scope": "0x2"}], "type": "loopback", "flags": ["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "macaddress": "unknown", "metric": "0", "mtu": "16384", "options": ["PERFORMNUD", "AUTO_LINKLOCAL"]}, "ansible_bridge0": {"device": "bridge0", "ipv4": [{"address": "10.0.1.1", "netmask": "255.0.0.0", "network": "10.0.0.0", "broadcast": "10.255.255.255"}], "ipv6": [], "type": "ether", "flags": ["UP", "BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "macaddress": "02:32:d5:59:09:00", "metric": "0", "mtu": "1500", "options": ["PERFORMNUD", "IFDISABLED"]}, "ansible_playground_host": {"device": "playground_host", "ipv4": [], "ipv6": [{"address": "fe80::5a:d1ff:feca:4a0a%playground_host", "prefix": "64", "scope": "0x4"}], "type": "ether", "flags": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "macaddress": "02:5a:d1:ca:4a:0a", "metric": "0", "mtu": "1500", "options": ["PERFORMNUD", "AUTO_LINKLOCAL"], "media": "Ethernet", "media_select": "10Gbase-T", "media_type": "10Gbase-T", "media_options": ["full-duplex"], "status": "active"}, "ansible_skeleton_host": {"device": "skeleton_host", "ipv4": [], "ipv6": [{"address": "fe80::52:a4ff:fe2a:750a%skeleton_host", "prefix": "64", "scope": "0x5"}], "type": "ether", "flags": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "macaddress": "02:52:a4:2a:75:0a", "metric": "0", "mtu": "1500", "options": ["PERFORMNUD", "AUTO_LINKLOCAL"], "media": "Ethernet", "media_select": "10Gbase-T", "media_type": "10Gbase-T", "media_options": ["full-duplex"], "status": "active"}, "ansible_default_ipv4": {"gateway": "192.168.178.1", "interface": "em0", "device": "em0", "type": "ether", "flags": ["UP", "BROADCAST", "RUNNING", "PROMISC", "SIMPLEX", "MULTICAST"], "macaddress": "00:0c:29:0d:66:92", "metric": "0", "mtu": "1500", "options": ["PERFORMNUD", "ACCEPT_RTADV", "AUTO_LINKLOCAL"], "media": "Ethernet", "media_select": "autoselect", "media_type": "1000baseT", "media_options": ["full-duplex"], "status": "active", "address": "192.168.178.83", "netmask": "255.255.255.0", "network": "192.168.178.0", "broadcast": "192.168.178.255"}, "ansible_default_ipv6": {}, "ansible_all_ipv4_addresses": ["192.168.178.83", "10.0.1.1"], "ansible_all_ipv6_addresses": ["fe80::20c:29ff:fe0d:6692%em0", "2a02:8109:b5c0:28ac:20c:29ff:fe0d:6692", "fe80::5a:d1ff:feca:4a0a%playground_host", "fe80::52:a4ff:fe2a:750a%skeleton_host"], "ansible_pkg_mgr": "pkgng", "ansible_local": {}, "ansible_lsb": {}, "ansible_virtualization_type": "VMware", "ansible_virtualization_role": "guest", "ansible_service_mgr": "bsdinit", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDWu0oNrQ2NUDf9Itnw1nFtKanraFi0KrQHDALjJje5SGX7ITN+kzw0igBaKCmhyGtg3nueyx1OxXoUtwsrpMQ+tnqjgOKK9dLk9/k7hYK2LKiQ2DqN1T6LQhiOqRaryuUtUvV7n2U7lnQHcgBIXeMZgd1YKViHQPYCbx8SQa0lkV/+rQNmz91dg9UMYoH01Mg69gFhwl8k9gp6OP1LVf51zUPPyzQbaWENW7BKtR2OAlpUxbAHZqoVBqXZzCIWdF8dus0b98aDjN1XXOmjLSqonJ6qU4D6U5PXY55tIHykkK0lqYFVrmH8fCpmtHW86E9cgBy/MuiT4XzYNU17CdaN", "ansible_ssh_host_key_rsa_public_keytype": "ssh-rsa", "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFca6GprbeZRdmkywJ7YVLaz9TEEEw/R/jlIwAhaZqZMJQtvjIi+NmeZkmyopPyduZtWDScupAp7R4t45DY5a58=", "ansible_ssh_host_key_ecdsa_public_keytype": "ecdsa-sha2-nistp256", "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAICgghWaTHxwjyhctPD+Vdu/cJ/cZ3osESXUICBoPRE7P", "ansible_ssh_host_key_ed25519_public_keytype": "ssh-ed25519", "ansible_fips": false, "ansible_env": {"LC_CTYPE": "C.UTF-8", "SSH_CLIENT": "192.168.178.87 52843 22", "LOGNAME": "root", "MAIL": "/var/mail/root", "PATH": "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin", "OLDPWD": "/root", "PWD": "/root", "_": "/bin/sh", "TERM": "su", "HOME": "/root", "USER": "root", "SSH_CONNECTION": "192.168.178.87 52843 192.168.178.83 22", "SHELL": "/usr/local/bin/zsh", "BLOCKSIZE": "K", "SHLVL": "0"}, "ansible_apparmor": {"status": "disabled"}, "ansible_python": {"version": {"major": 3, "minor": 7, "micro": 9, "releaselevel": "final", "serial": 0}, "version_info": [3, 7, 9, "final", 0], "executable": "/usr/local/bin/python3.7", "has_sslcontext": true, "type": "cpython"}, "ansible_dns": {"search": ["fritz.box"], "nameservers": ["192.168.178.1"]}, "ansible_iscsi_iqn": "", "ansible_fibre_channel_wwn": [], "gather_subset": ["all"], "module_setup": true}, "invocation": {"module_args": {"gather_subset": ["all"], "gather_timeout": 10, "filter": "*", "fact_path": "/etc/ansible/facts.d"}}}\n', b'')
[WARNING]: Platform freebsd on host 192.168.178.83 is using the discovered Python interpreter at /usr/local/bin/python3.7, but future installation of
another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
ok: [192.168.178.83]
META: ran handlers

TASK [Test] ******************************************************************************************************************************************
task path: /Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/Jails.Playground/Playground.yml:18
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'which -s jailme'
<192.168.178.83> (1, b'jailme not found\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<192.168.178.83> Failed to connect to the host via ssh: Shared connection to 192.168.178.83 closed.
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'jls -q jid name host.hostname path'
<192.168.178.83> (0, b'27 playground playground /jails/playground\r\n28 skeleton skeleton /jails/skeleton\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'jexec 27 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'echo ~root'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<192.168.178.83> (0, b'/root\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'jexec 27 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1614806741.668855-10047-15427075687577 `" && echo ansible-tmp-1614806741.668855-10047-15427075687577="` echo /root/.ansible/tmp/ansible-tmp-1614806741.668855-10047-15427075687577 `" )'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<192.168.178.83> (0, b'ansible-tmp-1614806741.668855-10047-15427075687577=/root/.ansible/tmp/ansible-tmp-1614806741.668855-10047-15427075687577\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<192.168.178.83> Attempting python interpreter discovery
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'jexec 27 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'; echo ENDFOUND'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<192.168.178.83> (0, b'PLATFORM\r\nFreeBSD\r\nFOUND\r\n/usr/local/bin/python3.7\r\n/usr/local/bin/python\r\nENDFOUND\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<192.168.178.83> Python interpreter discovery fallback (unsupported platform for extended discovery: freebsd)
Using module file /usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/modules/command.py
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 mktemp
<192.168.178.83> (0, b'/tmp/tmp.mfaUtK4V\r\n', b'Shared connection to 192.168.178.83 closed.\r\n')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'chmod 0644 /tmp/tmp.mfaUtK4V'
<192.168.178.83> (0, b'', b'Shared connection to 192.168.178.83 closed.\r\n')
<192.168.178.83> PUT /Users/keziah/.ansible/tmp/ansible-local-10038ml6mzmn9/tmp53qtojuw TO /tmp/tmp.mfaUtK4V
<192.168.178.83> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 '[192.168.178.83]'
<192.168.178.83> (0, b'sftp> put /Users/keziah/.ansible/tmp/ansible-local-10038ml6mzmn9/tmp53qtojuw /tmp/tmp.mfaUtK4V\n', b'')
<[email protected]> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.178.83> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/Users/keziah/.ansible/cp/912f20e3a5 -tt 192.168.178.83 'jexec 27 /bin/sh -c '"'"'/bin/sh -c '"'"'"'"'"'"'"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1614806741.668855-10047-15427075687577/ > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"' && sleep 0'
<192.168.178.83> (0, b'', b'Shared connection to 192.168.178.83 closed.\r\n')
The full traceback is:
Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 663, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/command.py", line 26, in run
    results = merge_hash(results, self._execute_module(module_name='ansible.legacy.command', task_vars=task_vars, wrap_async=wrap_async))
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 888, in _execute_module
    self._transfer_data(remote_module_path, module_data)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 498, in _transfer_data
    self._transfer_file(afile, remote_path)
  File "/usr/local/Cellar/ansible/3.0.0/libexec/lib/python3.9/site-packages/ansible/plugins/action/__init__.py", line 475, in _transfer_file
    self._connection.put_file(local_path, remote_path)
  File "/Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible/connection_plugins/sshjail.py", line 437, in put_file
    self._copy_file(tmp, out_path)
  File "/Users/keziah/Development/Diaries/keziah.de (FreeBSD, Staging)/ansible/connection_plugins/sshjail.py", line 407, in _copy_file
    copycmd = plugin.build_become_command(' '.join(['cp', from_file, to_file]), shell)
AttributeError: 'NoneType' object has no attribute 'build_become_command'
fatal: [192.168.178.83]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

NO MORE HOSTS LEFT ***********************************************************************************************************************************

PLAY RECAP *******************************************************************************************************************************************
192.168.178.83             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

No longer works against latest ansible (2.4)

It looks like Ansible has changed it's internal API and this no longer works against the latest 2.4.0 release (devel).

Are you still using this? Is it worth putting some effort into getting it working? Another possibility is to extend the packaged jail/iocage connector plugs so that that can make a remote ssh connection if specified.

the connection plugin 'sshjail' was not found

When using the dev_ansible_v2 branch with ansible 2.0.0.2, I get the error:

ERROR! the connection plugin 'sshjail' was not found

The file itself is found and compiled.

Using your patched version of ansible is not an option for me.

ImportError: No module named callbacks

In my hosts file:

[server]
server.example.com

[jails]
[email protected] ansible_python_interpreter=/usr/local/bin/python2.7 ansible_connection=sshjail ansible_ssh_port=2200

in playbook:

    - name: hostname in jail
      delegate_to: test@server
      shell: hostname
      tags: jail

when I try run like this:
ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook go.yml -i hosts -t jail -vvv

I got error:

TASK [hostname in jail] ********************************************************
task path: /root/ansible/idesign/go.yml:201
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 124, in run
    res = self._execute()
  File "/usr/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 411, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 636, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin)
  File "/usr/local/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 333, in get
    self._module_cache[path] = self._load_module_source('.'.join([self.package, name]), path)
  File "/usr/local/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 319, in _load_module_source
    module = imp.load_source(name, path, module_file)
  File "/usr/local/lib/python2.7/site-packages/ansible/plugins/connection/sshjail.py", line 9, in <module>
    from ansible.callbacks import vvv
ImportError: No module named callbacks

fatal: [server.example.com]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}

<server.example.com> ESTABLISH SSH CONNECTION FOR USER: None
<server.example.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=2200 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r server.example.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1475412043.37-71725684956622 `" && echo ansible-tmp-1475412043.37-71725684956622="` echo $HOME/.ansible/tmp/ansible-tmp-1475412043.37-71725684956622 `" ) && sleep 0'"'"''

NO MORE HOSTS LEFT *************************************************************
    to retry, use: --limit @go.retry

I replace my real server name to server.example.com.

Looks broken with ansible 2.0.0.2

I have it in /ansible/connection_plugins/

> ansible-playbook -vvvv -l [email protected] site.yml
Using /ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
3 plays in site.yml
 _______________________________
< PLAY [main playbook] >
 -------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

 ______________
< TASK [setup] >
 --------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/executor/process/worker.py", line 114, in run
    self._shared_loader_obj,
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 119, in run
    res = self._execute()
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 366, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 582, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin)
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 326, in get
    self._module_cache[path] = self._load_module_source('.'.join([self.package, name]), path)
  File "/ansible/venv/local/lib/python2.7/site-packages/ansible/plugins/__init__.py", line 313, in _load_module_source
    module = imp.load_source(name, path, module_file)
  File "/ansible/connection_plugins/sshjail.py", line 9, in <module>
    from ansible.callbacks import vvv
ImportError: No module named callbacks

fatal: [[email protected]]: FAILED! => {"failed": true, "stdout": ""}
 ______

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.