ansible-role-openpolicyagent/action_plugins/openpolicyagent_config_generate.py

20 lines
549 B
Python
Raw Permalink Normal View History

2019-10-07 22:09:33 +00:00
#!/usr/bin/env python
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
config = self._task.args.get('config')
varname = self._task.args.get('var_name')
_config = {}
for config_item in config:
if config[config_item]:
_config[config_item] = self._templar.template(config[config_item])
return dict(
ansible_facts={varname: self._templar.template(_config)},
changed=False
)