Re: [vagrant-up] WinRM::WinRMAuthorizationError with a Windows 2012 R2 guest
Hi Alvaro, At least the base image changed to a newer version of windows (that is, it was fresh installed again, with latest windows updates; but I no longer have the older base box). Not sure if the vagrant or the VB versions have changed, but probably they were... because I update my Arch Linux regularly (and I don't keep track of which versions I've used before). It somewhat odd, this happens after the Windows Domain Controller has been installed with Install-ADDSForest (at the end of the provision/domain-controller.ps1 provision file). Maybe the vagrant account is temporally disabled and that makes it drop the existing WinRM connections? Please note, that this error didn't happen before, because I could vagrant up the entire thing without any problems. After the WinRM::WinRMAuthorizationError shows up, using a second shell, I can successfully connect with WinRM with something like: winrm -hostname localhost -port 2202 -username vagrant -password vagrant 'ipconfig /all' (the winrm binary comes from https://github.com/masterzen/winrm; which is the same project that is used by packer) I have no clue on how to troubleshoot this further :-/ -- RGL On Sunday, October 9, 2016 at 7:28:48 PM UTC+1, Alvaro Miranda Aguilera wrote: > > Hello, > > Better use a link to a gist, rather than the log. > > I haven't checked the log, but I would like to ask what changed? > > If you did update OS and Vagrant/Virtualbox, any chance you can test with > what used to work? > And any chance to test in a different computer? > and finally, with a different box? > > Alvaro. > > On Sat, Oct 8, 2016 at 7:28 PM, Rui Lopes> wrote: > >> I'm trying to launch the >> https://github.com/rgl/windows-domain-controller-vagrant environment. It >> worked before, but for some reason it has started to fail with >> WinRM::WinRMAuthorizationError errors. Its odd because I can login without >> problems. Maybe a recent windows update changed anything? >> >> I've pasted the relevant log bellow. Any help would be appreciated! >> >> I'm on a recent Arch Linux host with VirtualBox 5.1.6 and Vagrant 1.8.6. >> >> Megan also reported [0] this error happening with a Windows 10 guest. >> Maybe this is related. >> >> -- RGL >> >> [0] https://groups.google.com/forum/#!topic/vagrant-up/7m25sAD__N8 >> >> INFO global: Vagrant version: 1.8.6 >> INFO global: Ruby version: 2.2.5 >> INFO global: RubyGems version: 2.4.5.1 >> INFO global: VAGRANT_OLD_ENV_GTK_MODULES="canberra-gtk-module" >> INFO global: VAGRANT_OLD_ENV_SHLVL="2" >> INFO global: VAGRANT_OLD_ENV_XDG_VTNR="7" >> INFO global: VAGRANT_OLD_ENV_XDG_SESSION_ID="c2" >> INFO global: VAGRANT_OLD_ENV_PAGER="less" >> INFO global: VAGRANT_OLD_ENV_LANG="en_US.utf8" >> INFO global: >> VAGRANT_OLD_ENV_DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" >> INFO global: VAGRANT_OLD_ENV_XAUTHORITY="/home/rgl/.Xauthority" >> INFO global: VAGRANT_OLD_ENV_MAIL="/var/spool/mail/rgl" >> INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded" >> INFO global: VAGRANT_OLD_ENV_GLADE_MODULE_PATH=":" >> INFO global: VAGRANT_OLD_ENV_HG="/usr/bin/hg" >> INFO global: VAGRANT_OLD_ENV_LOGNAME="rgl" >> INFO global: VAGRANT_OLD_ENV_XDG_CURRENT_DESKTOP="XFCE" >> INFO global: VAGRANT_INSTALLER_VERSION="2" >> INFO global: VAGRANT_OLD_ENV_OLDPWD="/home/rgl" >> INFO global: >> VAGRANT_OLD_ENV_PWD="/home/rgl/Projects/windows-domain-controller-vagrant" >> INFO global: VAGRANT_OLD_ENV_SHELL="/bin/bash" >> INFO global: VAGRANT_OLD_ENV_GLADE_CATALOG_PATH=":" >> INFO global: VAGRANT_OLD_ENV_XDG_RUNTIME_DIR="/run/user/1000" >> INFO global: VAGRANT_INSTALLER_ENV="1" >> INFO global: VAGRANT_OLD_ENV_WINDOWID="37761619" >> INFO global: VAGRANT_OLD_ENV_XDG_CONFIG_DIRS="/etc/xdg" >> INFO global: VAGRANT_OLD_ENV_XDG_SEAT="seat0" >> INFO global: VAGRANT_OLD_ENV_LC_TIME="pt_PT.UTF-8" >> INFO global: VAGRANT_OLD_ENV_GLADE_PIXMAP_PATH=":" >> INFO global: VAGRANT_OLD_ENV_DESKTOP_SESSION="xfce" >> INFO global: VAGRANT_OLD_ENV_USER="rgl" >> INFO global: VAGRANT_OLD_ENV_EDITOR="vim" >> INFO global: VAGRANT_OLD_ENV_GDMSESSION="xfce" >> INFO global: VAGRANT_OLD_ENV_XDG_DATA_DIRS="/usr/local/share:/usr/share" >> INFO global: VAGRANT_OLD_ENV_SSH_AGENT_PID="5804" >> INFO global: VAGRANT_OLD_ENV_ANT_HOME="/usr/share/apache-ant" >> INFO global: VAGRANT_OLD_ENV_XDG_SESSION_DESKTOP="xfce" >> INFO global: VAGRANT_OLD_ENV_DISPLAY=":0.0" >> INFO global: >> VAGRANT_OLD_ENV_SESSION_MANAGER="local/go:@/tmp/.ICE-unix/5790,unix/go:/tmp/.ICE-unix/5790" >> INFO global: VAGRANT_OLD_ENV_HOME="/home/rgl" >> INFO global: >> VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/gems/vagrant-1.8.6/bin/vagrant" >> INFO global: >> VAGRANT_OLD_ENV_XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/rgl" >> INFO global: VAGRANT_OLD_ENV_TERM="xterm" >> INFO global: VAGRANT_OLD_ENV_XDG_MENU_PREFIX="xfce-" >> INFO global: >> VAGRANT_OLD_ENV_XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
[vagrant-up] Re: Vagrant supporting Ansible -u command
Hi Gilles, I *think* I see where you are going with this but it ends up with the following error message " UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}" Running ansible directly the following commands work ansible-playbook -v -e "@overridden_variables.json" -i inventories/demo.hosts -u ubuntu --ask-become-pass add_deployment_user.yml ansible-playbook -v -e "@overridden_variables.json" -i inventories/demo.hosts -u ansible_user demo.yml Therefore if I assume that the vagrant user is the same as my initial ubuntu user and that the first playbook creates the user "ansible_user" then I believe that the following should work in the same way on vagrant 1.8.5 Vagrant.require_version ">= 1.7.0" Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" # Disable the new default behavior introduced in Vagrant 1.7, to # ensure that all Vagrant machines will use the same SSH key pair. # See https://github.com/mitchellh/vagrant/issues/5005 config.ssh.insert_key = false # Setup the user first config.vm.provision "deployuser", type: "ansible" do |ansible| ansible.verbose = "v" ansible.playbook = "add_deployment_user.yml" ansible.sudo = true ansible.raw_arguments = ["-e '@overridden_variables.json'"] end config.vm.provision "demo", type: "ansible" do |ansible| ansible.verbose = "v" ansible.playbook = "demo.yml" ansible.raw_arguments = ["-e '@overridden_variables.json'", "-u ansible_user"] remote_user = "ansible_user" ansible.raw_ssh_args = ['-o ForwardAgent=yes','-o ControlMaster=auto','-o ControlPersist=5m'] ansible.force_remote_user = false end end However it doesn't. Now one of the things in the override_variables is a list of keys which includes my public key which is different to the insecure_private_key used by vagrant. So in the case of the second ssh what key is used? On Monday, October 10, 2016 at 7:30:06 AM UTC+1, Gilles Cornu wrote: > > 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 vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit
[vagrant-up] Re: Vagrant supporting Ansible -u command
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 vagrant-up+unsubscr...@googlegroups.com. 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.