msg: Destination /usr/local/bin not writable

1,182 views
Skip to first unread message

Nic Flores

unread,
Jun 26, 2014, 5:44:59 PM6/26/14
to ansible...@googlegroups.com
Hi All,
I'm trying to execute the following playbook:

-bash-4.1$ cat edit_backup.yml
---
- name: editing backup
  hosts: test

  tasks:
  - name: copy new backup.sh file
    copy: src=backup.sh dest=/usr/local/bin/backup.sh owner=root group=bin mode=700

on a machine that has an ansbile service account user with sudo privileges. I can log into the machine just just fine as this ansible user and execute sudo commands.

But when I execute this playbook using the following, I get:

-bash-4.1$ ansible-playbook -vvv edit_backup.yml -i hosts -u ansible --ask-pass
SSH password:

PLAY [editing cron] ***********************************************************

GATHERING FACTS ***************************************************************
<my-webdev> ESTABLISH CONNECTION FOR USER: ansible on PORT 22 TO my-webdev
<my-webdev> REMOTE_MODULE setup
<my-webdev> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513 && echo $HOME/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513'
<my-webdev> PUT /tmp/tmpk0Zps6 TO /home/ansible/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513/setup
<my-webdev> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513/setup; rm -rf /home/ansible/.ansible/tmp/ansible-tmp-1403818631.23-81487564346513/ >/dev/null 2>&1'
ok: [my-webdev]

TASK: [copy new backup.sh file] **********************************************
<my-webdev> ESTABLISH CONNECTION FOR USER: ansible on PORT 22 TO my-webdev
<my-webdev> EXEC /bin/sh -c 'rc=0; [ -r "/usr/local/bin/backup.sh" ] || rc=2; [ -f "/usr/local/bin/backup.sh" ] || rc=1; [ -d "/usr/local/bin/backup.sh" ] && echo 3 && exit 0; (/usr/bin/md5sum /usr/local/bin/backup.sh 2>/dev/null) || (/sbin/md5sum -q /usr/local/bin/backup.sh 2>/dev/null) || (/usr/bin/digest -a md5 /usr/local/bin/backup.sh 2>/dev/null) || (/sbin/md5 -q /usr/local/bin/backup.sh 2>/dev/null) || (/usr/bin/md5 -n /usr/local/bin/backup.sh 2>/dev/null) || (/bin/md5 -q /usr/local/bin/backup.sh 2>/dev/null) || (/usr/bin/csum -h MD5 /usr/local/bin/backup.sh 2>/dev/null) || (/bin/csum -h MD5 /usr/local/bin/backup.sh 2>/dev/null) || (echo "${rc} /usr/local/bin/backup.sh")'
<my-webdev> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223 && echo $HOME/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223'
<my-webdev> PUT /home/ansible/backup.sh TO /home/ansible/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223/source
<my-webdev> PUT /tmp/tmptCeWat TO /home/ansible/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223/copy
<my-webdev> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223/copy; rm -rf /home/ansible/.ansible/tmp/ansible-tmp-1403818632.3-204501082662223/ >/dev/null 2>&1'
failed: [my-webdev] => {"failed": true, "md5sum": "838d85475a9fe3b2a2fa619a54544776"}
msg: Destination /usr/local/bin not writable

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/home/ansible/edit_backup.retry

my-webdev                : ok=1    changed=0    unreachable=0    failed=1


I tested this on two separate virtual machines on my desktop with a local ansible account on the target machines with sudo privileges and it works just fine. 

Any suggestions as to what might be blocking ansible from executing sudo commands? I'm assuming that's why the "Destination /usr/local/bin not writable" message shows up.

Thanks,
Nic

Michael DeHaan

unread,
Jun 27, 2014, 8:44:44 AM6/27/14
to ansible...@googlegroups.com
(A)

Do you have permission to write into /usr/local/bin from sudo or is it constrained?

(B)

What flags are you executing Ansible playbook with?  Looks like you are missing "sudo: True" in your playbook.



--
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/c46fe3d1-f320-45dc-8a24-49b306d7469e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages