In my case I am mounting my Ansible code inside a Docker container under /ansible/playbook/
. Under this directory you will see the roles
, inventories
I would like to mount another directory that contains some RPM files.
In Ansible I have this code:
---
- name: copy ZooKeeper rpm file
copy:
src: zookeeper-3.4.13-1.x86_64.rpm
dest: /tmp
- name: install ZooKeeper rpm package
yum:
name: /tmp/zookeeper-3.4.13-1.x86_64.rpm
state: present
The problem is that ZooKeeper does not exist in any of the default search paths:
Could not find or access 'zookeeper-3.4.13-1.x86_64.rpm'
Searched in:
/ansible/playbook/roles/kafka/files/zookeeper-3.4.13-1.x86_64.rpm
/ansible/playbook/roles/kafka/zookeeper-3.4.13-1.x86_64.rpm
/ansible/playbook/roles/kafka/tasks/files/zookeeper-3.4.13-1.x86_64.rpm
/ansible/playbook/roles/kafka/tasks/zookeeper-3.4.13-1.x86_64.rpm
/ansible/playbook/files/zookeeper-3.4.13-1.x86_64.rpm
/ansible/playbook/zookeeper-3.4.13-1.x86_64.rpm
How can I add extra search paths to this list for example:
/ansible/rpms/zookeeper-3.4.13-1.x86_64.rpm//
I don't want to hardcode absolute paths (if this works) in the Ansible code. I would like to provide something like: ANSIBLE_EXTRA_SEARCH_PATH
.
How can I do this?
PS: I cannot create a symlink to my RPM directory inside the already mounted /ansible/playbook
because Docker will see it and a bad link (not being able to read it, because the target directory, the one containing the RPM files is not part of the Docker container file system.)