diff options
Diffstat (limited to 'roles/lib_yaml_editor/build/ansible')
-rw-r--r-- | roles/lib_yaml_editor/build/ansible/yedit.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/roles/lib_yaml_editor/build/ansible/yedit.py b/roles/lib_yaml_editor/build/ansible/yedit.py index bf868fb71..dab3d6347 100644 --- a/roles/lib_yaml_editor/build/ansible/yedit.py +++ b/roles/lib_yaml_editor/build/ansible/yedit.py @@ -24,7 +24,7 @@ def main(): yamlfile = Yedit(module.params['src'], module.params['content']) - rval = yamlfile.get() + rval = yamlfile.load() if not rval and state != 'present': module.fail_json(msg='Error opening file [%s]. Verify that the' + \ ' file exists, that it is has correct permissions, and is valid yaml.') @@ -45,13 +45,16 @@ def main(): if rval: rval = yamlfile.put(module.params['key'], value) + if rval[0]: + yamlfile.write() module.exit_json(changed=rval[0], results=rval[1], state="present") if not module.params['content']: rval = yamlfile.create(module.params['key'], value) else: - yamlfile.write() - rval = yamlfile.get() + rval = yamlfile.load() + yamlfile.write() + module.exit_json(changed=rval[0], results=rval[1], state="present") module.exit_json(failed=True, |