<repo_name>ichikawa0311/filter_plugins<file_sep>/dict_get.py
from ansible.errors import AnsibleError

class FilterModule(object):

    def dict_get(self, a_dict, a_key):
        if( not isinstance(a_dict,dict) ):
            raise AnsibleError('the parameter is not dict')
        if( not (a_key in a_dict.keys() ) ):
            raise AnsibleError("dict doesnt have a key "+a_key)
        return a_dict[a_key]
    def filters(self):
        return {
            # 左側がPlaybook内で使用するフィルター名、右側が紐付ける関数名。
            'dict_get': self.dict_get,
        }
<file_sep>/README.md
# filter_plugins
ansibleのfilter_plugin置き場

## filter_plugins

### dict_get

get specified dict value.
useful to specify key as variable.

```
"{{ some_dict | dict_get(some_key) }}"
```

# Features
 
TBD
 
# Requirement
 
TBD
 
* python 2.7.5
* ansible 2.10.7
 
# Installation

TBD
 
## Usage
TBD
 
# Note
 
TBD
# Author
 
* ichikawa
 
# License
 
[MIT license](https://en.wikipedia.org/wiki/MIT_License).
 
