# Vagrant bug reproduction - ansible provisioner breaks when the `inventory_path` option's value contain spaces Documents the reproduction of a bug in Vagrant's Ansible provisioner when the `inventory_path` option's value contains spaces. ## Prerequisites The following software must be installed on the reproduction environment: * A text terminal (e.g., Terminal, iTerm2, GNOME Terminal, etc.) * Ansible * Git * Vagrant * VirtualBox ## Steps to reproduce The following are the minimal steps to reproduce the issue: 1. Launch a text terminal. 1. Run the following command to clone this repository to a path containing spaces: ```bash git clone https://github.com/brlin-tw/vagrant-issue-9597-reproduction.git "vagrant issue-9597-reproduction" ``` 1. Change the current working directory to the cloned repository: ```bash cd "vagrant issue-9597-reproduction" ``` 1. Review the files in the repository if necessary. 1. Run the following command to start the Vagrant VM and provision it with Ansible: ```bash vagrant up ``` The Ansible provisioner should fail with the following similar error message: ```text TASK [Ping the host] *********************************************************** fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: OpenSSH_9.6p1 Ubuntu-3ubuntu13.14, OpenSSL 3.0.13 30 Jan 2024\r\ndebug1: Reading configuration data /home/brlin/.ssh/config\r\ndebug1: Reading configuration data /home/brlin/.ssh/hashbang.config\r\ndebug1: Reading configuration data /home/brlin/.ssh/tetherfi.config\r\ndebug1: Reading configuration data /home/brlin/.ssh/remarkable.config\r\ndebug1: Reading configuration data /home/brlin/.ssh/vagrant.config\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug1: auto-mux: Trying existing master at '/home/brlin/.ansible/cp/58b16fd052'\r\ndebug1: Control socket \"/home/brlin/.ansible/cp/58b16fd052\" does not exist\r\nssh: Could not resolve hostname issue-9597-reproduction/.vagrant/machines/default/virtualbox/private_key: Name or service not known", "unreachable": true} ``` ## References The following materials are referenced during the development of this project: * [inventory_path - Common Ansible Options - Provisioning | Vagrant | HashiCorp Developer](https://developer.hashicorp.com/vagrant/docs/provisioning/ansible_common#inventory_path) Explains the `inventory_path` option of the Ansible provisioner in Vagrant. * [`ANSIBLE_SSH_ARGS` `-o IdentityFile=` option fails to quote path to private key and breaks on spaces · Issue #9597 · hashicorp/vagrant](https://github.com/hashicorp/vagrant/issues/9597) Corresponding GitHub issue.