Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible is being run in a world writable directory (/vagrant), ignoring it as an ansible.cfg source #11707

Closed
abhishekkarigar opened this issue Jun 18, 2020 · 3 comments

Comments

@abhishekkarigar
Copy link

abhishekkarigar commented Jun 18, 2020

Vagrant version

Vagrant 2.2.9

Host operating system

windows 10 ( + cygwin )

Guest operating system

ubuntu/trusty64

Vagrantfile

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder ".", "/vagrant"
    config.vm.provision "ansible_local" do |ansible|
      ansible.become = true
      ansible.playbook = "playbook.yml"
      ansible.inventory_path = ".vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory"  
      ansible.limit = "all"
      ansible.verbose = true
      ansible.install = true
      vagrant_synced_folder_default_type = ""
  end
end

Debug output

https://gist.github.com/abhishekkarigar/3dce6b3caf2fe6a868e288c76ad70582

Expected behavior

successfull provisioned

Actual behavior

[WARNING] Ansible is being run in a world writable directory (/vagrant), ignoring it as an 
ansible.cfg source. For more information see https:// 
docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir

Steps to reproduce

  1. minimal playbook.yml file
  2. vagrant provision or vagrant up --provision

References

Are there any other GitHub issues (open or closed) that should be linked here?
For example:

@gildegoma
Copy link
Collaborator

The relevant error is not the warning you mentioned, but the following Ansible Playbook Task that failed:

TASK [Gathering Facts] *********************************************************
 INFO interface: info: fatal: [default]: UNREACHABLE! => 
{"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 127.0.0.1 port 2222: Connection refused", "unreachable": true}

fatal: [default]: UNREACHABLE! => 
{"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 127.0.0.1 port 2222: Connection refused", "unreachable": true}

From your Vagrantfile and your log ouptut, I guess that you initially used the Ansible remote (ansible) provisioner, and then switched to the ansible_local provisioner. Ansible is trying to SSH from the guest into itself via localhost:2222, which doesn't make sense (unlike from the Vagrant host).

Please fully remove your ansible.inventory_path (and maybe ansible.limit) option(s). This should resolve your problem. If you face further problem, could you please ask on https://discuss.hashicorp.com/c/vagrant/24. Thank you ❤️

@abhishekkarigar
Copy link
Author

Thank you @gildegoma , it worked now for ansible_local from cygwin

silly to have asked this question.
yes, you are right, i tried first with ansible provisioner then switched to ansible_local provisioner.

i was exploring these different provisioners from cygwin
anyway good lesson for me ,
thanks again

@ghost
Copy link

ghost commented Jul 20, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants