I am using vagrant to run ubuntu VM on my Mac. I am trying to provision vagrant with the playbook I wrote but when I do im getting an error about the host. this is my Vagrant file:
Vagrant.configure("2") do |config| VAGRANT_DEFAULT_PROVIDER = "virtualbox" config.vm.hostname = "carebox-idan" #config.vm.provision "ansible", playbook: "playbook.yml" config.vm.network "public_network", ip: "192.168.56.4", bridge: ["en0: Wi-Fi (Wireless)"] config.vm.box = "laravel/homestead" config.vm.network "forwarded_port", guest: 8200, host: 8200, auto_correct: "true" config.ssh.forward_agent = true end this is my playbook.yml: --- - name: Playbook to install and use Vault become: true hosts: server1 #gather_facts: no tasks: - name: Uptade1 become: true become_user: root shell: uname -a register: bla - debug: msg: "{{ bla.stdout }}" - name: Uptade1 become: true become_user: root shell: apt update - name: gpg become: true become_user: root shell: apt install gpg - name: verify key become: true become_user: root shell: wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null - name: fingerprint become: true become_user: root shell: gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint - name: repository become: true become_user: root shell: echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list - name: update2 become: true become_user: root shell: apt update - name: vault install become: true become_user: root shell: apt install vault this is my inventory: all: hosts: server1: ansible_host: 192.168.56.4 the error I get while using this command - `ansible-playbook -i /Users/idan/carebox/inventory.yml playbook.yml` is: fatal: [server1]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.56.4 port 22: Operation timed out", "unreachable": true} PLAY RECAP ********************************************************************* server1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 I tried changing the host ip in the inventory to 127.0.0.1 and it says the same but with "connection refused" or 0.0.0.0 but it keeps giving this error. I also tried making the ip in Vagrntfile to "private_key" and It also didn't work. it only works if I am provisioning in the vagrant up but I want to do it manually after I start vagrant, with the command I wrote here above. I would really like some help, thank you! -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/76e712be-27ca-4272-9d36-0853393812f9n%40googlegroups.com.