From 4dcc5042e6a5ab70de755e2d9d3bdab7e37d45f5 Mon Sep 17 00:00:00 2001 From: Russell Teague Date: Wed, 27 Sep 2017 10:18:23 -0400 Subject: Rename filter_plugins to unique names Filter plugin modules should have unique names to not conflict with core Ansible modules. (Ansible 2.4) --- .../filter_plugins/openshift_aws_filters.py | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 roles/openshift_aws/filter_plugins/openshift_aws_filters.py (limited to 'roles/openshift_aws/filter_plugins/openshift_aws_filters.py') diff --git a/roles/openshift_aws/filter_plugins/openshift_aws_filters.py b/roles/openshift_aws/filter_plugins/openshift_aws_filters.py new file mode 100644 index 000000000..06e1f9602 --- /dev/null +++ b/roles/openshift_aws/filter_plugins/openshift_aws_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} -- cgit v1.2.3