summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/ansible/oc_label.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-05 13:17:57 -0500
committerGitHub <noreply@github.com>2017-02-05 13:17:57 -0500
commita965c28ab7ca6ac93c70e4a2415316ddaf52812e (patch)
tree7da0c11ef0426553991cd3527d91bcd2854f42c2 /roles/lib_openshift/src/ansible/oc_label.py
parentec0983dc4bc96573e3f7f958aea7040c15c1db81 (diff)
parent4b054d7da5f404dfd8eb238b617e4dcf7dc93b17 (diff)
downloadopenshift-a965c28ab7ca6ac93c70e4a2415316ddaf52812e.tar.gz
openshift-a965c28ab7ca6ac93c70e4a2415316ddaf52812e.tar.bz2
openshift-a965c28ab7ca6ac93c70e4a2415316ddaf52812e.tar.xz
openshift-a965c28ab7ca6ac93c70e4a2415316ddaf52812e.zip
Merge pull request #3249 from kwoodson/oc_label
Adding oc_label to lib_openshift.
Diffstat (limited to 'roles/lib_openshift/src/ansible/oc_label.py')
-rw-r--r--roles/lib_openshift/src/ansible/oc_label.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/ansible/oc_label.py b/roles/lib_openshift/src/ansible/oc_label.py
new file mode 100644
index 000000000..28f004621
--- /dev/null
+++ b/roles/lib_openshift/src/ansible/oc_label.py
@@ -0,0 +1,32 @@
+# pylint: skip-file
+# flake8: noqa
+
+def main():
+ ''' ansible oc module for labels '''
+
+ module = AnsibleModule(
+ argument_spec=dict(
+ kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
+ state=dict(default='present', type='str',
+ choices=['present', 'absent', 'list', 'add']),
+ debug=dict(default=False, type='bool'),
+ kind=dict(default='node', type='str', required=True,
+ choices=['node', 'pod', 'namespace']),
+ name=dict(default=None, type='str'),
+ namespace=dict(default=None, type='str'),
+ labels=dict(default=None, type='list'),
+ selector=dict(default=None, type='str'),
+ ),
+ supports_check_mode=True,
+ mutually_exclusive=(['name', 'selector']),
+ )
+
+ results = OCLabel.run_ansible(module.params, module.check_mode)
+
+ if 'failed' in results:
+ module.fail_json(**results)
+
+ module.exit_json(**results)
+
+if __name__ == '__main__':
+ main()