oc_service.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # pylint: skip-file
  2. # flake8: noqa
  3. def main():
  4. '''
  5. ansible oc module for services
  6. '''
  7. module = AnsibleModule(
  8. argument_spec=dict(
  9. kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
  10. state=dict(default='present', type='str',
  11. choices=['present', 'absent', 'list']),
  12. debug=dict(default=False, type='bool'),
  13. namespace=dict(default='default', type='str'),
  14. name=dict(default=None, type='str'),
  15. annotations=dict(default=None, type='dict'),
  16. labels=dict(default=None, type='dict'),
  17. selector=dict(default=None, type='dict'),
  18. clusterip=dict(default=None, type='str'),
  19. portalip=dict(default=None, type='str'),
  20. ports=dict(default=None, type='list'),
  21. session_affinity=dict(default='None', type='str'),
  22. service_type=dict(default='ClusterIP', type='str'),
  23. external_ips=dict(default=None, type='list'),
  24. ),
  25. supports_check_mode=True,
  26. )
  27. rval = OCService.run_ansible(module.params, module.check_mode)
  28. if 'failed' in rval:
  29. return module.fail_json(**rval)
  30. return module.exit_json(**rval)
  31. if __name__ == '__main__':
  32. main()