ansible-for-kubernetes icon indicating copy to clipboard operation
ansible-for-kubernetes copied to clipboard

Ansible is being run in a world writable directory... ignoring it as an ansible.cfg source

Open Xaeco opened this issue 3 years ago • 4 comments
trafficstars

On page 74 in

Chapter 3 - Ansible manages containers

When running command:

$ ansible-galaxy install -r requirements.yml

It runs with a warning:

[WARNING]: Ansible is being run in a world writable directory (/mnt/c/Users/<username>/documents/afk/ansible-solr-container), 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
Starting galaxy role install process
- downloading role 'java', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/1.10.0.tar.gz
- extracting geerlingguy.java to /home/wsl/.ansible/roles/geerlingguy.java
- geerlingguy.java (1.10.0) was installed successfully
- downloading role 'solr', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-solr/archive/5.3.0.tar.gz
- extracting geerlingguy.solr to /home/wsl/.ansible/roles/geerlingguy.solr
- geerlingguy.solr (5.3.0) was installed successfully

It installs the roles but not in the correct location:

$ ls -1 roles
ls: cannot access 'roles': No such file or directory

Following the link in the warning leads to options to resolve the issue. I used:

export ANSIBLE_CONFIG=./ansible.cfg

then re-ran the command:

$ ansible-galaxy install -r requirements.yml

which put them into the correct location:

$ ls -1 roles
geerlingguy.java
geerlingguy.solr

Xaeco avatar Dec 16 '21 03:12 Xaeco

@Xaeco - Hmm... "Ansible is being run in a world writable directory" seems to indicate this directory has 777 permissions, and typically Ansible restricts loading ansible.cfg files in that case (for good reason—someone could do a lot of damage writing to that file!). I haven't ever noticed that warning, but did you by chance set the folder to have world-read/write/execute permissions?

geerlingguy avatar Dec 16 '21 22:12 geerlingguy

My files are in my user profile documents folder in Windows and being accessed by Ansible within WSL. I have tried changing permissions in both environments and changing the mount to no avail.

So I went with the environment variable option for now as I'm planning on removing Windows this Xmas break and going full Linux to immerse myself for a while.

Xaeco avatar Dec 17 '21 01:12 Xaeco

going full Linux to immerse myself for a while.

Ooh, good luck!

geerlingguy avatar Dec 17 '21 23:12 geerlingguy

Was tempted to quote a line from Tropic Thunder

Xaeco avatar Dec 19 '21 22:12 Xaeco