Custom username with Chef Client

17 views
Skip to first unread message

christoffer....@basalt.se

unread,
Apr 18, 2016, 4:51:42 PM4/18/16
to Vagrant
I am trying to provision a VM using the chef_client provisioner but it tries to authenticate with my current username. I want to use another one instead. In fact, I do not want to use the .chef folder inside the current directory (in the same folder as the Vagrantfile), but instead use the one in vagrant/.chef since the Chef server for Vagrant is different than the production server.

How do I do this?

Alvaro Miranda Aguilera

unread,
Apr 18, 2016, 4:55:46 PM4/18/16
to vagra...@googlegroups.com
How does your Vagrantfile looks?

If you can came up with a command like that works.

ie

sudo su -
cd /vagrant/.chef
su - -u <other user> <command>

you could use a shell script to run your command.

Alvaro.

On Tue, Apr 19, 2016 at 8:51 AM, <christoffer....@basalt.se> wrote:
I am trying to provision a VM using the chef_client provisioner but it tries to authenticate with my current username. I want to use another one instead. In fact, I do not want to use the .chef folder inside the current directory (in the same folder as the Vagrantfile), but instead use the one in vagrant/.chef since the Chef server for Vagrant is different than the production server.

How do I do this?

--
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/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c27838cf-af5b-47c0-9109-ab5e22238ca9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

christoffer....@basalt.se

unread,
Apr 19, 2016, 1:33:50 AM4/19/16
to Vagrant
Vagrant.configure(2) do |c|
  c.vm.box = 'bento/centos'
  c.vm.provision :chef_client do |chef|
    chef.chef_server_url = 'https://chef.example.com/organizations/foobar'
    chef.validation_key_path = 'vagrant/.chef/validator.pem'
    chef.add_role 'web'
  end
end
Reply all
Reply to author
Forward
0 new messages