30. 標準モジュールに準拠させる(2/2)
#!/usr/bin/python
import datetime
DOCUMENTATION = '''
module: timetest
version_added: 1.9.2
short_description: Get date and time
description:
- Get date and time on target node
options: {}
author:
- "Hideki Saito"
'''
EXAMPLES = '''
# Get date and time
ansible target -m timetest
'''
def main():
module = AnsibleModule(argument_spec={})
date = dict(now=str(datetime.datetime.now()))
module.exit_json(**date)
from ansible.module_utils.basic import *
main()
本家にPull Requestするなら
このような形式が必須です
30