destination not writable error

2,346 views
Skip to first unread message

Sol

unread,
Aug 27, 2015, 11:11:49 AM8/27/15
to Ansible Project
Hello, 
I'm trying to run a simple test playbook to copy files over to a vagrant vm.  The specs are:
ubuntu/trusty64 box 
vagrant 1.7.3 
ansible 1.9.2
 

The playbook looks like this:
---
- hosts: test-db
  tasks:
  - name: Add vagrant sudoers file
    copy: src=vagrant_sudoers dest=/etc/sudoers.d/vagrant validate='visudo -cf %s' group=root owner=root mode=440
    sudo: true

  - name: Add deploy group sudoers file
    copy: src=deploy_sudoers dest=/etc/sudoers.d/deploy validate='visudo -cf %s' group=root owner=root mode=440
    sudo: true

Here is how i ran the playbook:

$ ansible-playbook -i ansible_hosts -u vagrant -U vagrant --private-key=/home/sol/tmp/postgis/.vagrant/machines/db/virtualbox/private_key --sudo test.yml 


And getting the output:



PLAY [all] ******************************************************************** 


GATHERING FACTS *************************************************************** 

ok: [192.168.50.4]


TASK: [Add vagrant sudoers file] ********************************************** 

failed: [192.168.50.4] => {"checksum": "f817b060b579b9ba2b9850b1177c0a2e938ab326", "failed": true}

msg: Destination /etc/sudoers.d not writable


FATAL: all hosts have already failed -- aborting



I can log in to the vagrant box as user vagrant and run sudo commands.   I'm wondering if i'm missing anything or this is a bug. I have been stuck on this for hours and any help would be appreciated!


-Sol

Brian Coca

unread,
Aug 27, 2015, 11:24:01 AM8/27/15
to Ansible Project
-u vagrant -U vagrant <= makes no sense, if you login as vagrant you
don't need to sudo TO vagrant, you probalby want to leave -U vagrant
out and the default (sudo to root) should work.



--
Brian Coca

Sol

unread,
Aug 27, 2015, 11:56:57 AM8/27/15
to Ansible Project
dang! I didn't think that thru. Works as it should now. I appreciate your help!
Reply all
Reply to author
Forward
0 new messages