2017-04-02 80 views
0

我有問題Ansible拿起我添加的模塊。Ansible沒有拿起自定義模塊

  1. 該模塊被稱爲'passwordstore'https://github.com/morphje/ansible_pass_lookup/
  2. 我正在使用Ansible 2.2
  3. 在我的手冊中,我添加了一個'庫'文件夾,並將該GitHub目錄的內容添加到該文件夾​​中。我也嘗試去除註釋library = /usr/share/ansible/modules,並在那裏添加模塊文件,但仍然沒有拿起。
  4. 也試過環境變量設置爲ANSIBLE_LIBRARY=/usr/share/ansible/modules

我Ansible劇本是這樣的:

--- 

- name: example play 
    hosts: all 
    gather_facts: false 

    tasks: 
    - name: set password 
     debug: msg="{{ lookup('passwordstore', 'files/test create=true')}}" 

當我運行此我得到這個錯誤;

ansible-劇本main.yml

PLAY [example play] ****************************************************** 

TASK [set password] ************************************************************ 
fatal: [backend.example.name]: FAILED! => {"failed": true, "msg": "lookup plugin (passwordstore) not found"} 
fatal: [mastery.example.name]: FAILED! => {"failed": true, "msg": "lookup plugin (passwordstore) not found"} 
     to retry, use: --limit @/etc/ansible/roles/test-role/main.retry 

對我失去了我的任何指導?這可能只是我試圖添加自定義模塊的方式,但任何指導都將不勝感激。

回答

2

這是一個查找插件(不是模塊),所以它應該進入名爲lookup_plugins(而不是library)的目錄。

或者,使用lookup-plugins setting將路徑添加到ansible.cfg中的克隆存儲庫。