# Unable to provision a Windows Server 2019 vagrant box with Ansible over ssh

**URL:** <https://forum.ansible.com/t/unable-to-provision-a-windows-server-2019-vagrant-box-with-ansible-over-ssh/34537>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 29, 2021, 1:41pm UTC](https://forum.ansible.com/t/unable-to-provision-a-windows-server-2019-vagrant-box-with-ansible-over-ssh/34537 "2021-01-29T13:41:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amedee\_Van\_Gasse](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Amedee\_Van\_Gasse](https://forum.ansible.com/u/Amedee_Van_Gasse)\
**Post date:** [January 29, 2021, 1:41pm UTC](https://forum.ansible.com/t/unable-to-provision-a-windows-server-2019-vagrant-box-with-ansible-over-ssh/34537/1 "2021-01-29T13:41:08Z")

</div>

I have created a Windows server 2019 Vagrant box using [https://github.com/rgl/windows-vagrant](https://github.com/rgl/windows-vagrant). I did not make any changes.

Steps to reproduce:

git clone [git@github.com](mailto:git@github.com):rgl/windows-vagrant.git  
cd windows-vagrant  
make build-windows-2019-virtualbox

Then I added the new box with

vagrant box add -f windows-2019-amd64 windows-2019-amd64-virtualbox.box

Vagrantfile:

Vagrant.configure(“2”) do |config|  
config.vm.box = “windows-2019-amd64”  
config.vm.provision :ansible do |ansible|  
ansible.playbook = “./provisioners/ansible/ansible\_playbook.yml”  
ansible.config\_file = “./provisioners/ansible/ansible.cfg”  
ansible.inventory\_path = “vagrant\_ansible\_inventory”  
config.vm.network “forwarded\_port”, guest: 22, host: 2222  
end  
end

vagrant\_ansible\_inventory:

default ansible\_connection=ssh ansible\_host=127.0.0.1 ansible\_port=2222 ansible\_user=‘vagrant’ ansible\_password=‘vagrant’ ansible\_ssh\_pass=‘vagrant’

I can start the box:

vagrant up --no-provision

I can connect to the box over ssh:

vagrant ssh

(drops me into a DOS shell on the Windows Server 2019, where I can execute DOS shell commands like dir)

I _cannot_ provision:

vagrant provision

results in error

==\> default: Running provisioner: ansible…  
default: Running ansible-playbook…

PLAY [Jenkins node playbook] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Friday 29 January 2021 14:38:19 +0100 (0:00:00.015) 0:00:00.015 \*\*\*\*\*\*\*\*  
fatal: [default]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "`echo ~/.ansible/tmp`"&& mkdir ~/.ansible/tmp/ansible-tmp-1611927499.9836688-402851-78433964159130 && echo ansible-tmp-1611927499.9836688-402851-78433964159130="`echo ~/.ansible/tmp/ansible-tmp-1611927499.9836688-402851-78433964159130`" ), exited with result 1”, “unreachable”: true}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

Friday 29 January 2021 14:38:20 +0100 (0:00:00.312) 0:00:00.327 \*\*\*\*\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Amedee\_Van\_Gasse](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Amedee\_Van\_Gasse](https://forum.ansible.com/u/Amedee_Van_Gasse)\
**Post date:** [January 29, 2021, 6:52pm UTC](https://forum.ansible.com/t/unable-to-provision-a-windows-server-2019-vagrant-box-with-ansible-over-ssh/34537/2 "2021-01-29T18:52:45Z")

</div>

Solution: put ansible\_shell\_type=‘powershell’ in the inventory file.
