Packer with an ansible-local provisions => Failed to set permissions on the temporary files error

336 views
Skip to first unread message

a...@sanger.ac.uk

unread,
Jul 20, 2018, 4:14:13 PM7/20/18
to Packer
In my ansible file I have a few tasks where I need to become a user and install software as that user 

I have configured this as follows

- name: Install Linuxbrew
git:
dest: '~{{ primary_user }}/.linuxbrew'
become: yes
become_user: '{{ primary_user }}'
become_flags: '-i'
become_method: sudo

However it errors saying that 

Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user


This is provisioned by packer as follows

    {
     "type": "ansible-local",
     "playbook_file": "ansible/assembly.yml"
   }

Other ansible commands operate fine but those with become: yes fail

Any advice much appreciated. Thanks

Anthony

Rickard von Essen

unread,
Jul 20, 2018, 4:42:15 PM7/20/18
to packe...@googlegroups.com
This is an common ansible problem (and Packer has nothing to do with it). Nevertheless read this:

Especially try to install the package including setfacl. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/169c6bde-f235-4649-8f3c-a97a0f52153c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

a...@sanger.ac.uk

unread,
Jul 20, 2018, 5:03:25 PM7/20/18
to Packer
Thanks for the reply.

I did see the ansible docs about unprivileged users but when I install the acl package I get a new error

sudo: no tty present and no askpass program specified

The reason I thought this may be packer related is that when I use the same playbook using vagrant provisioning in the same host background Ubuntu 18.04, I don't have these problems 

Rickard von Essen

unread,
Jul 20, 2018, 5:10:16 PM7/20/18
to packe...@googlegroups.com
Does your ssh_user have passwordless sudo? 

a...@sanger.ac.uk

unread,
Jul 20, 2018, 5:32:50 PM7/20/18
to Packer
I have 
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",

in the packer json file and

# Add vagrant user to sudoers.
echo 'vagrant ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/vagrant

in a setup script

Rickard von Essen

unread,
Jul 21, 2018, 2:18:13 AM7/21/18
to packe...@googlegroups.com
I don't know if that susdoers syntax is correct. Try this:

vagrant ALL=(ALL) NOPASSWD: ALL

Anthony Underwood

unread,
Jul 21, 2018, 3:42:40 PM7/21/18
to Packer
I had your suggestion at first but when I changed it to
vagrant ALL=(ALL:ALL) NOPASSWD:ALL

it worked!! Thanks for your help
Reply all
Reply to author
Forward
0 new messages