Bug with Custom Setup.ps1 File in New PPA Release

Hey gang,

I have a custom version of the ‘setup.ps1’ file in my ‘/etc/ansible/library’ (It allows me to gather facter facts on Windows). In 1.9 Ansible would correctly run ‘setup.py’ on Linux hosts, and my custom ‘library/setup.ps1’ on Windows hosts. However, now EVERYTHING is grabbing that custom ‘setup.ps1’. Am I doing something weird, or is this broken now? It may be worth having a conversation on ‘setup.ps1’ should be renamed ‘win_setup.ps1’ or something to help prevent this kind of collision,

Anything I can do, or should I attempt to roll back to 1.9 for the moment? Should I file a formal bug on github?

Thanks!

  • Corwin

if the file where named 'setup' (no extension) this would be expected,
but no this seems like a bug.

I too use a custom setup.ps1 but hadn’t noticed your issue. However I have a copy of setup.py in my /etc/ansible/library so as a workaround that might save you from having to go back to 1.9.4.

Jon

Hmm, so if I place a ‘setup.py’ in /etc/ansible/library I still have the issue. Now I’m not as convinced its not something I’m doing. For giggles, here’s the specific error:

Using /home/blakfeld/p4depots/perforce_corp/d-cbrown_ansible_trunk/ansible.cfg as config file

Loaded callback default of type stdout, v2.0

2 plays in ./test_playbook.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************

<172.16.100.11> ESTABLISH SSH CONNECTION FOR USER: vagrant

<172.16.100.11> SSH: EXEC sshpass -d14 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o User=vagrant -o ConnectTimeout=10 -o ControlPath=/home/blakfeld/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.16.100.11 ‘( umask 22 && mkdir -p “$( echo /tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402 )” && echo “$( echo /tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402 )” )’

<172.16.100.11> PUT /tmp/tmpedHVyL TO /tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402/setup

<172.16.100.11> SSH: EXEC sshpass -d14 scp -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o User=vagrant -o ConnectTimeout=10 -o ControlPath=/home/blakfeld/.ansible/cp/ansible-ssh-%h-%p-%r /tmp/tmpedHVyL ‘[172.16.100.11]:/tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402/setup’

<172.16.100.11> ESTABLISH SSH CONNECTION FOR USER: vagrant

<172.16.100.11> SSH: EXEC sshpass -d14 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o User=vagrant -o ConnectTimeout=10 -o ControlPath=/home/blakfeld/.ansible/cp/ansible-ssh-%h-%p-%r -tt 172.16.100.11 ‘/bin/sh -c ‘"’“'sudo -H -S -n -u root /bin/sh -c '”’“'”‘"’“'”‘"’“‘echo BECOME-SUCCESS-kiqfevmhxxfozxxtpnwgikkenrjonfkg; LANG=C LC_ALL=C LC_MESSAGES=C powershell /tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402/setup; rm -rf “/tmp/.ansible/tmp/ansible-tmp-1452785840.72-172858349812402/” > /dev/null 2>&1’”‘"’“'”‘"’“'”‘"’‘"’"‘’

fatal: [172.16.100.11]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “setup”}, “module_stderr”: “OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /home/blakfeld/.ssh/config\r\ndebug1: /home/blakfeld/.ssh/config line 18: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 6056\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 172.16.100.11 closed.\r\n”, “module_stdout”: “/bin/sh: 1: powershell: not found\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}

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

PLAY RECAP *********************************************************************

172.16.100.11 : ok=0 changed=0 unreachable=0 failed=1

As you can see this is just a vagrant box I’m trying to connect to locally.

Thanks all!

-Corwin

Yep, I’m seeing the same thing. I’ve created an issue at https://github.com/ansible/ansible/issues/13894, and I’ll take a look to see what we can do about it.

I’ve also hit this issue, I’ve not managed to work out a fix, but I’ve got a workaround documented here -

https://github.com/ansible/ansible/issues/13894#issuecomment-293949183

Regards,

Barney.