summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/action/read_file.py
blob: ec43e1e67ab6e83297a557143efe6d6743f6f6f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python

from ansible.plugins.action import ActionBase
from ansible_collections.tensin.infra.plugins.module_utils import file


class ActionModule(ActionBase):
    def run(self, tmp=None, task_vars=None):
        result = super().run(tmp, task_vars)

        path = self._task.args["path"]
        default = self._task.args.get("default")

        result["content"] = file.read_file(self, path, task_vars, default=default)
        return result