In the ansible documentation intro_configuration it is said that:
Ansible ... it also will look for modules in the ”./library” directory alongside a playbook.
Im my case the only way I get that the directive provide by gaqzi.ssh-config
was seen by ansible was to explicitly export ANSIBLE_LIBRARY with a full path ;(
Without that gaqzi.ssh-config
module is not found by ansible, regarding the documentation it should.
Here what I have to do to make it work::
$ cd playbook # my folder were the plabooks are
$ ansible-galaxy install -p library gaqzi.ssh-config # I get a lib
$ export ANSIBLE_LIBRARY=/home/me/full/path/to/the/above/playbook/library
$ # the export above is annoying
How can I dynamicaly check the places Ansible is really looking for 'library' ?
PS1: I'm using ansible 2.0 and vagrant 1.8.1::
$ vagrant --version
Vagrant 1.8.1
$ ansible --version
ansible 2.0.0.2
config file = /etc/ansible/ansible.cfg
$
PS2: I took care to remove all ansible.cfg/.ansible.cfg files excepted the one provide by ubuntu in /etc/ansible/ansible.cfg
Ansible actually do search in current_playbook/library
directory.
You can test this with the following setup:
Place this custom_module.py
into library
subdir:
#!/usr/bin/python
import json
print json.dumps({"hello" : "world"})
Make the following test.yml
playbook:
---
- hosts: localhost
tasks:
- name: custom module
custom_module:
Execute ansible-playbook -vv test.yml
With ansible-galaxy
you install role, not module.
Parameter -p
for ansible-galaxy
defines the ROLE_PATH
.
If you want just a module ssh_config
from the gaqzi.ssh-config
role,
you need to copy the ssh_config.py
from current_playbook/library/gaqzi.ssh-config/library
into current_playbook/library
.
Alternatively you can install the gaqzi.ssh-config
role into roles
directory, as expected.
Then modify your playbook to apply this role by adding:
roles:
- gaqzi.ssh-config
After applying this role, module ssh_config
will become available in your playbook.
Actually, you can set a role module as a dependency of your role, for example in your meta/main.yml file:
---
dependencies:
- { role: gaqzi.ssh-config }
Then you can start using the module in your role.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With