Guest User

Untitled

a guest
Jan 6th, 2014
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3.  
  4. def main():
  5.     module = AnsibleModule(
  6.         argument_spec = dict(
  7.             state     = dict(default='present', choices=['present', 'absent']),
  8.             name      = dict(required=True),
  9.         ),
  10.         supports_check_mode = True,
  11.     )
  12.  
  13.     f=open('/tmp/foo','w')
  14.     name=module.params['name']
  15.     if type(name) == type(''):
  16.         f.write(module.params['name'])
  17.     elif type(name) == type({}):
  18.         for k in name.keys():
  19.             f.write('%s %s ' % (k,name[k]))
  20.     elif type(name) == type([]):
  21.         for k in name:
  22.             f.write('%s ' % (k))
  23.     f.close()
  24.  
  25.     module.exit_json(changed=True)
  26.  
  27. # import module snippets
  28. from ansible.module_utils.basic import *
  29. main()
Advertisement
Add Comment
Please, Sign In to add comment