Issue 1:
Hi All,

I'm trying to execute Ansible against remote machine having /bin/csh as default shell. It fails as Ansible uses variables in command line and this syntax is not recognized by installed TCSH shell.

Machine is not very old (RHEL 6.3) but has default /bin/csh shell because it hosts old application using Korn shell by default.

/bin/csh --version
tcsh 6.17.00

$ LANG=C ./script.sh
LANG=C: Command not found.

Machine has bash installed and I've changed Ansible executable to Bash but still some Ansible operations adds LANG variables.

echo -e "[defaults]\nexecutable = /bin/bash\nmodule_lang = C" > ~/ansible.cfg
export ANSIBLE_CONFIG=~/ansible.cfg

Here is output taken from -vvvv

Shouldn't setting executable to /bin/bash fix that ? I see that 3 from 4 commands use bash but command actually executing script doesn't use bash.

ansible somehost -u user2 -m script -a script.sh -vvvv

<somehost> ESTABLISH CONNECTION FOR USER: user2
<somehost> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/user1/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user2 -o ConnectTimeout=10 somehost /bin/bash -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958 && echo $HOME/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958'
<somehost> PUT /home/user1/script.sh TO /u/user2/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958/script.sh
<somehost> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/user1/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user2 -o ConnectTimeout=10 somehost /bin/bash -c 'chmod +rx /u/user2/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958/script.sh'
<somehost> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/user1/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user2 -o ConnectTimeout=10 somehost LANG=C LC_CTYPE=C /u/user2/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958/script.sh
<somehost> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/user1/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user2 -o ConnectTimeout=10 somehost /bin/bash -c 'rm -rf /u/user2/.ansible/tmp/ansible-tmp-1448562735.38-94558238272958/ >/dev/null 2>&1'

Ansible version: 1.9.4

Issue 2:
Issue Type:

Bug Report

Ansible Version:

ansible 1.6

Environment:

Destinations are FreeBSD hosts with csh as a shell.

Summary:

The script module tries to set LC_CTYPE and LANG before executing the script. This works with sh and bash, but fails with csh

Steps To Reproduce:

Simple playbook using script

- name: csh shell test
hosts: all
remote_user: root
gather_facts: False
tasks:
- script: foo.sh

Expected Results:

Command to behave like the raw module and not try to set LC_CTYPE/LANG when using script, or add some kind of option to turn this feature on/off on a per host basis if it is required to normalize output for parsing.

Actual Results:

failed: [10.2.3.4] => {"changed": true, "rc": 1}
stdout: LC_CTYPE=C: Command not found.