New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local_action running on jump host when connection delegation is enabled? #251

Closed
Aeon opened this Issue May 18, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@Aeon

Aeon commented May 18, 2018

Hi, and thank you for the awesome project

Trying to get it set up for testing with mitogen_via option, and immediately running into the following when I run my playbook against a small group of hosts:

fatal: [morty2]: UNREACHABLE! => {"changed": false, "msg": "error occurred on host bastion1: Child start failed: [Errno 2] No such file or directory. Command was: \"/webapps/xyzzy/venv/bin/python2.7\" \"-c\" \"import codecs,os,sys;_=codecs.decode;exec(_(_(\\\"eNpd0FFLwzAQB/Bn+yl8u4SF0nRjaKGgFPG9D/ZBRbr0psGsCWm7OD+9Nzo09S2/+1/uSGrRlHZInXbIeOJFiKT314S99Z+MF8kVnbvJ5SwTMsv4n2sRy1MqZytjB2R1DB+jiRFmYH/U3vbPcF8/PmXwWg4nKn6hmsZ2Z3DuIRq2DMSSK2AHPdp37ItBfWA3GfR3rj39Ih3UMW2dM5gqeyhyudnecuAJjQ9ej8ikgIcqe+mpVpVv7PwRnXXY0/PB74CnHtuOSSlvtlzAt3bz5UtTIyAA/ctlWBVnYZnBJpfrNS1aVf/Xy/P6Hzv/gWU=\\\".encode(),\\\"base64\\\"),\\\"zip\\\"))\"", "unreachable": true}
fatal: [morty7]: UNREACHABLE! => {"changed": false, "msg": "error occurred on host bastion1: Child start failed: [Errno 2] No such file or directory. Command was: \"/webapps/xyzzy/venv/bin/python2.7\" \"-c\" \"import codecs,os,sys;_=codecs.decode;exec(_(_(\\\"eNpd0FFLwzAQB/Bn+yl8u4SF0nRjaKGgFPG9D/ZBRbr0psGsCWm7OD+9Nzo09S2/+1/uSGrRlHZInXbIeOJFiKT314S99Z+MF8kVnbvJ5SwTMsv4n2sRy1MqZytjB2R1DB+jiRFmYH/U3vbPcF8/PmXwWg4nKn6hmsZ2Z3DuIRq2DMSSK2AHPdp37ItBfWA3GfR3rj39Ih3UMW2dM5gqeyhyudnecuAJjQ9ej8ikgIcqe+mpVpVv7PwRnXXY0/PB74CnHtuOSSlvtlzAt3bz5UtTIyAA/ctlWBVnYZnBJpfrNS1aVf/Xy/P6Hzv/gWU=\\\".encode(),\\\"base64\\\"),\\\"zip\\\"))\"", "unreachable": true}
fatal: [morty4]: UNREACHABLE! => {"changed": false, "msg": "error occurred on host bastion1: Child start failed: [Errno 2] No such file or directory. Command was: \"/webapps/xyzzy/venv/bin/python2.7\" \"-c\" \"import codecs,os,sys;_=codecs.decode;exec(_(_(\\\"eNpd0FFLwzAQB/Bn+yl8u4SF0nRjaKGgFPG9D/ZBRbr0psGsCWm7OD+9Nzo09S2/+1/uSGrRlHZInXbIeOJFiKT314S99Z+MF8kVnbvJ5SwTMsv4n2sRy1MqZytjB2R1DB+jiRFmYH/U3vbPcF8/PmXwWg4nKn6hmsZ2Z3DuIRq2DMSSK2AHPdp37ItBfWA3GfR3rj39Ih3UMW2dM5gqeyhyudnecuAJjQ9ej8ikgIcqe+mpVpVv7PwRnXXY0/PB74CnHtuOSSlvtlzAt3bz5UtTIyAA/ctlWBVnYZnBJpfrNS1aVf/Xy/P6Hzv/gWU=\\\".encode(),\\\"base64\\\"),\\\"zip\\\"))\"", "unreachable": true}
...

Of course this is because /webapps/xyzzy/venv/bin/python2.7 does not exist on the jump host. However, since it's local_action, shouldn't it still run on localhost?

For reference, the local action is a initial step to ensure that a network-based disk image is mounted before we copy data off it to remote hosts. Looks something like this:

  - name: mount latest source.dmg
    local_action:
      module: shell
      args: |
        if [[ -d /tmp/Project ]]; then
          hdiutil detach /tmp/Project
        fi
        hdiutil attach /Corp/Source/Images/Current/Project.dmg -nobrowse -mountpoint /tmp/Project
    tags:
      - preflight

But I am pretty sure that the content of the action is irrelevant, the issue is that it's trying to execute on jumphost. It would actually even work there, probably, if the interpreter path was correct.

I tried setting ansible_python_interpreter config var for the jumphost, but that did nothing.

Thanks again
Anton

@dw

This comment has been minimized.

Owner

dw commented May 18, 2018

Great catch! That's super broken :) Give me 15 minutes

dw added a commit that referenced this issue May 18, 2018

issue #251: ansible: watch for delegate_to during connection delegation.
This needs more work -- pretty certain that python_path and suchlike are
coming from the wrong place. Possibly we need another config_from_..()
specialized for delegate_to.
@dw

This comment has been minimized.

Owner

dw commented May 18, 2018

Hi there,

I've pushed a partial fix to issue251 branch, but it looks like it'll need more work to correctly derive variables in every case. My head is swimming in issues with mainline Ansible this week, so possibly things will just work already (Mitogen local connections should inherit the interpreter used to start Ansible, but not certain of that)

@dw dw added the user-reported label Jun 10, 2018

@ayaz

This comment has been minimized.

ayaz commented Jun 29, 2018

Removed my comment. Created #291 instead.

dw added a commit that referenced this issue Aug 10, 2018

issue #251: ansible: watch for delegate_to during connection delegation.
This needs more work -- pretty certain that python_path and suchlike are
coming from the wrong place. Possibly we need another config_from_..()
specialized for delegate_to.

@dw dw added the target:v0.2 label Aug 11, 2018

dw added a commit that referenced this issue Aug 18, 2018

issue #251: ansible: watch for delegate_to during connection delegation.
This needs more work -- pretty certain that python_path and suchlike are
coming from the wrong place. Possibly we need another config_from_..()
specialized for delegate_to.
@dw

This comment has been minimized.

Owner

dw commented Aug 19, 2018

This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://www.freelists.org/list/mitogen-announce

Thanks for reporting this!

@dw dw closed this Aug 19, 2018

@michalmedvecky

This comment has been minimized.

michalmedvecky commented Sep 13, 2018

I came here via google, I have a similar problem with 0.2.2:

error occurred on host 55a78418c587: Child start failed: [Errno 2] No such file or directory. Command was: sudo -u root -H /usr/bin/python2 -c "import codecs,os,sys;_=codecs.decode;exec(_(_(\"eNqFkEtrwzAQhM/xr/BtJSISOQ/iGgQtOZQeSsGU+tCG4ofcijqSkJ246a/vxgnETg+97cfO7gwTs0SYemKVlYR6jrU9UqWPUBr3RWjkjXAudnZGOAs4pxeOWZ8cboMT55WpJYn74PqQ9KFFQMP6gPZV2qDr1hfChyJ1rdLgp7rolvJb5rsmzSrZrae72k0zpaf20HwaDZhzdCUbi+5wL12tjH6N5pvOVuq9cshwF9+/cNiI4dlJg1iR4YINcQxkqxrzIXXkjGlul8t0FS6CMF+Gqyi84RSoh59apxpJAgaPD89PnPM3DZggNwUWTb21eCfHqgtjpcaCwWVAJ06mBQlmizmnDH6UxU+lFRddwqDN4Nh+ac8G624+NXqlbv9T/00ZDFL+AoQMrM4=\".encode(),\"base64\"),\"zip\"))"

This happens when my playbook runs a local_task with become: true but already runs under root (in a container)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment