2021-01-31 17:20:24 +00:00
|
|
|
# Copyright (c) 2016, Tsukinowa Inc. <info@tsukinowa.jp>
|
|
|
|
# Copyright (c) 2018, Ansible Project
|
2024-01-25 20:40:15 +00:00
|
|
|
from ansiblelater.rule import RuleBase
|
2021-01-31 17:20:24 +00:00
|
|
|
|
|
|
|
|
2024-01-25 20:40:15 +00:00
|
|
|
class CheckLocalAction(RuleBase):
|
2024-01-27 17:32:29 +00:00
|
|
|
rid = "ANS124"
|
2021-01-31 17:20:24 +00:00
|
|
|
description = "Don't use local_action"
|
2023-11-10 13:50:48 +00:00
|
|
|
helptext = "`delegate_to: localhost` should be used instead of `local_action`"
|
2021-01-31 17:20:24 +00:00
|
|
|
types = ["playbook", "task", "handler"]
|
|
|
|
|
|
|
|
def check(self, candidate, settings):
|
|
|
|
yamllines, errors = self.get_normalized_yaml(candidate, settings)
|
|
|
|
|
|
|
|
if not errors:
|
|
|
|
for i, line in yamllines:
|
2021-01-31 17:23:38 +00:00
|
|
|
if "local_action" in line:
|
2021-01-31 17:20:24 +00:00
|
|
|
errors.append(self.Error(i, self.helptext))
|
|
|
|
|
|
|
|
return self.Result(candidate.path, errors)
|