Hi Ian,

As of Vagrant 1.8+ the Ansible remote user is forced by default. Therefore 
your use case requires to set the "force_remote_user" option to *false*.

See:

   - 
   https://www.vagrantup.com/docs/provisioning/ansible.html#force_remote_user
   - https://github.com/mitchellh/vagrant/pull/6348

Hope it helps... Best regards,
Gilles


Le samedi 8 octobre 2016 12:00:08 UTC+2, Ian Smith a écrit :
>
> Hi,
>
> Probably a daft question but I'm looking at using vagrant to automate 
> bring up of machines created using ansible scripts. I've hit an issue in 
> that the existing playbook uses two play calls. One to the account that 
> already exists, so in this case vagrant and that all works. However the 
> first playbook creates a user called "ansible_user" and then the second 
> playbook call then uses -u ansible_user to indicate that the playbook is 
> run as that new user.
>
> What I've found is that in the second case with vagrant the playbook is 
> still run as the vagrant user. Even though in the output I can see that the 
> added -u ansible_user can be seen it seems that under Vagrant it has no 
> effect.
>
> So what I have for the playbook provisioning in my VagrantFile is the 
> following
>
> config.vm.provision "demotest1", type: "ansible" do |ansible|             
>                                                                          
>     ansible.verbose = "vvv"                                               
>                                                                         
>     ansible.playbook = "demo.yml"                                         
>                                                                   
>     ansible.raw_arguments = ["-e '@overridden_variables.json'", "-u 
> ansible_user"]                                                             
>                                        
>     ansible.raw_ssh_args = ['-o ForwardAgent=yes','-o 
> ControlMaster=auto','-o ControlPersist=5m']
> end
>
> But I can see that with the verbose on there is an attempt to create a 
> file in /home/ansible_user not as ansible_user which I have indicated but 
> as vagrant which fails due to permission issues.
>
> What am I missing in the config to make this all work?
>
> Kind regards, Ian
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/4a084f35-e50c-445a-ae8d-6496e98814d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to