0
私は「mysync」というモジュールを持っています。これは同期の小さな変更です。このチケットの最下部は、syncronizeとmysyncの差分です。これは、ライブラリディレクトリに配置されます。カスタムモジュールを見つけることができない可能性のあるプレイブック
library = /sites/utils/local/ansible/modules
モジュールをプレイブックで実行すると、モジュールが見つかりません。推薦?
@> cat play.yml
- hosts: all
name: put shop onto server
mysync:
mode: pull
module: shop
src: rsync://@[email protected]::shop.ear
dest: /sites/MODULES/
archive: no
compress: yes
copy_links: yes
delete: yes
links: yes
times: yes
use_ssh_args: yes
verify_host: no
delegate_to: "{{ inventory_hostname }}"
@>ansible-playbook ./sync_shop.yml --limit tst37 -vvv
ERROR! 'mysync' is not a valid attribute for a Play
The error appears to have been in '/sites/utils/local/ansible/modules/sync_shop.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- hosts: all
^here
@>diff diff /Library/Python/2.7/site-packages/ansible/modules/files/synchronize.py ./mysync.py
26,28c26,28
< module: synchronize
< version_added: "1.4"
< short_description: A wrapper around rsync to make common tasks in your playbooks quick and easy.
---
> module: mySync
> version_added: "2.1"
> short_description: A custom wrapper around rsync to get src-host, src and dest from ldap
302a303,304
> import socket
> from ansible.module_utils.ldapData import ldapData
370a373,382
> #myInv = ldapData(self.args.debug,self.args.file,self.args.refresh)
> myInv = ldapData()
> host = socket.getfqdn()
> mydata = hosts[host][instances]
> for inst in mydata:
> if 'depothost' in inst:
> src_host=inst['depothost']
> if src_host is None:
> module.fail_json(msg='Could not determine depothost')
>
378a391
> source.replace('@[email protected]',src_host)