Ansible, Linux, Ubuntu, windows 10

[ansible|windows 10] On ubuntu app ansible.cfg is ignored

os: ubuntu (windows 10)
ansible: 2.6.4

When you launch ansible-playbook and you have a local ansible.cfg, ubuntu throws this error:

[WARNING] Ansible is being run in a world writable directory  (/ mnt / c / code / ansible /....), ignoring it asan ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-di
r
ERROR! Invalid or no config file was supplied

The problem is related to the permissions that are given to the files by default, since in fact the latest versions see these permissions (777) as a security problem and ignore the file.

To avoid this problem just re-set the permissions of the wsl (windows subsystem linux) by creating the file /etc/wsl.conf

[Automount]
enabled = true
mountFsTab = false
root = / mnt /
options = “metadata, umask = 22, fmask = 11”

[network]
generateHosts = true
generateResolvConf = true

source: https://github.com/ansible/ansible/issues/42388#issuecomment-403926971

Annunci
Ansible, DevOps, Uncategorized

[Ansible] local_action on 127.0.0.1 aka local_hosts

Ansible allows to execute task on the local machine that launch ansible

for do that use the module local_action:

- name: local authorized key
  local_action: shell cat ~/.ssh/id_rsa.pub
  register: local_auth_key
  sudo: false

be very careful to always use sudo: false, because without this, ansible will try to run the command as sudo, and if the local user requires the use of the password, the task will fail.

Link:

Ansible, DevOps, Uncategorized

[Ansible] Resources, Tutorials, examples