Guest User

Untitled

a guest
Dec 6th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/usr/bin/python
  2. """
  3. Description:
  4. hajimete no ansible module
  5. """
  6. import json, shlex, sys
  7.  
  8.  
  9. def main():
  10. result = {}
  11. result['changed'] = False
  12. result['message'] = 'Hello, World!'
  13.  
  14. with open(sys.argv[1], 'rb') as args_file:
  15. args = args_file.read()
  16.  
  17. for arg in shlex.split(args):
  18. (key, value) = arg.split('=')
  19. if key == 'name':
  20. result['message'] = '{name:s} is good!'.format(name=value)
  21.  
  22. print(json.dumps(result))
  23.  
  24.  
  25. if __name__ == '__main__':
  26. main()
Add Comment
Please, Sign In to add comment