module is missing interpreter line during ansible file copy

2,578 views
Skip to first unread message

satheesh kumar

unread,
Mar 12, 2015, 5:18:25 PM3/12/15
to ansible...@googlegroups.com
I am trying to copy a file from local to the remote VM using ansible, but got below error.

My Playbook:

---
- hosts: linux
  remote_user: root
  tasks:
      - name: remove sudo password for Suse and RedHat OS family
        copy: src=waagent dest=/etc/sudoers.d/waagent owner=root group=root mode=0644
        sudo: true
        when: ansible_os_family == 'Suse' or ansible_os_family == 'RedHat'


Error:
TASK: [remove sudo password for Suse and RedHat OS family] ********************
fatal: [linux.cloudapp.net] => module is missing interpreter line

FATAL: all hosts have already failed -- aborting


My waagent file content is:
azureuser ALL = (ALL) NOPASSWD:ALL

When tried googling, it mentioned to add bash interpreter for these type of errors. In my case, I can't include the bash interpreter here as it is a sudo entry. can you help here

Toshio Kuratomi

unread,
Mar 16, 2015, 10:17:17 AM3/16/15
to ansible...@googlegroups.com

This sounds like some sort of bug or misconfiguration.   Ansible modules are short code files.  All of the modules that come with ansible (copy comes with ansible) are written in python and have certain substitutions performed on them.  One of those substitutions is changing the shebang line to point to the python interpreter on the remote machine.  To do this ansible must find an existing shebang line in the module.

The error you're getting is because ansible was unable to find a shebang line to substitute in the file that it thinks is the copy module.

I've just double checked and the copy module does have the required shebang line:  https://github.com/ansible/ansible-modules-core/blob/devel/files/copy.py

Some things to try:

- what version of ansible are you running? We can check to make sure the error isn't present there.

- does this also happen with ad hoc tasks using /usr/bin/ansible?
  ansible -I "linux.cloudapp.net," '*' -m copy -a "src=waagent dest=/etc/sudoers.d/waagent owner=root group=root mode=0644" -u root

- does this also happen if you try running ansible from another directory?  cd / && ansible[...]

-Toshio

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ab9ed7d3-0c86-43ca-a8c0-c47a1d77e4c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

satheesh kumar

unread,
Mar 26, 2015, 6:19:30 PM3/26/15
to ansible...@googlegroups.com
Thanks, I was trying to replace the default file with 0440 rights, thats why i got this error. I copied it with different filename in same path, works like a charm!
Reply all
Reply to author
Forward
0 new messages