summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/ansible/oc_edit.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-13 14:29:48 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-01-17 10:47:16 -0500
commitea33e223e34bb2b8efae6b165f3ac9729357cb46 (patch)
tree73c704561e5896835b1fcfbf281a7c700bfa4ee3 /roles/lib_openshift/src/ansible/oc_edit.py
parent07331b47724dbb7cd6952c1a2af54275ace7726e (diff)
downloadopenshift-ea33e223e34bb2b8efae6b165f3ac9729357cb46.tar.gz
openshift-ea33e223e34bb2b8efae6b165f3ac9729357cb46.tar.bz2
openshift-ea33e223e34bb2b8efae6b165f3ac9729357cb46.tar.xz
openshift-ea33e223e34bb2b8efae6b165f3ac9729357cb46.zip
Adding oc_edit module to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/ansible/oc_edit.py')
-rw-r--r--roles/lib_openshift/src/ansible/oc_edit.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/ansible/oc_edit.py b/roles/lib_openshift/src/ansible/oc_edit.py
new file mode 100644
index 000000000..5c5954747
--- /dev/null
+++ b/roles/lib_openshift/src/ansible/oc_edit.py
@@ -0,0 +1,48 @@
+# pylint: skip-file
+# flake8: noqa
+
+
+def main():
+ '''
+ ansible oc module for editing objects
+ '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
+ state=dict(default='present', type='str',
+ choices=['present']),
+ debug=dict(default=False, type='bool'),
+ namespace=dict(default='default', type='str'),
+ name=dict(default=None, required=True, type='str'),
+ kind=dict(required=True,
+ type='str',
+ choices=['dc', 'deploymentconfig',
+ 'rc', 'replicationcontroller',
+ 'svc', 'service',
+ 'scc', 'securitycontextconstraints',
+ 'ns', 'namespace', 'project', 'projects',
+ 'is', 'imagestream',
+ 'istag', 'imagestreamtag',
+ 'bc', 'buildconfig',
+ 'routes',
+ 'node',
+ 'secret',
+ 'pv', 'persistentvolume']),
+ file_name=dict(default=None, type='str'),
+ file_format=dict(default='yaml', type='str'),
+ content=dict(default=None, required=True, type='dict'),
+ force=dict(default=False, type='bool'),
+ separator=dict(default='.', type='str'),
+ ),
+ supports_check_mode=True,
+ )
+
+ rval = Edit.run_ansible(module.params, module.check_mode)
+ if 'failed' in rval:
+ module.fail_json(**rval)
+
+ module.exit_json(**rval)
+
+if __name__ == '__main__':
+ main()