summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/filter_plugins
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-08-30 17:47:48 -0400
committerKenny Woodson <kwoodson@redhat.com>2017-09-07 14:41:24 -0400
commitefe86b44bce679db38cca654818dc3837bb05f6a (patch)
tree3bf6d09a2906aea8784073aece30ec22b82788f2 /roles/openshift_aws/filter_plugins
parent63ecca817c45242f3db0495d99b947ba0471789e (diff)
downloadopenshift-efe86b44bce679db38cca654818dc3837bb05f6a.tar.gz
openshift-efe86b44bce679db38cca654818dc3837bb05f6a.tar.bz2
openshift-efe86b44bce679db38cca654818dc3837bb05f6a.tar.xz
openshift-efe86b44bce679db38cca654818dc3837bb05f6a.zip
Consolidating AWS roles and variables underneath openshift_aws role.
Diffstat (limited to 'roles/openshift_aws/filter_plugins')
-rw-r--r--roles/openshift_aws/filter_plugins/filters.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/openshift_aws/filter_plugins/filters.py b/roles/openshift_aws/filter_plugins/filters.py
new file mode 100644
index 000000000..06e1f9602
--- /dev/null
+++ b/roles/openshift_aws/filter_plugins/filters.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+'''
+Custom filters for use in openshift_aws
+'''
+
+
+class FilterModule(object):
+ ''' Custom ansible filters for use by openshift_aws role'''
+
+ @staticmethod
+ def build_instance_tags(clusterid, status='owned'):
+ ''' This function will return a dictionary of the instance tags.
+
+ The main desire to have this inside of a filter_plugin is that we
+ need to build the following key.
+
+ {"kubernetes.io/cluster/{{ openshift_aws_clusterid }}": 'owned'}
+
+ '''
+ tags = {'clusterid': clusterid,
+ 'kubernetes.io/cluster/{}'.format(clusterid): status}
+
+ return tags
+
+ def filters(self):
+ ''' returns a mapping of filters to methods '''
+ return {'build_instance_tags': self.build_instance_tags}