From bf98aa54642f6485d62a4dec2b1cccf2ac5a487c Mon Sep 17 00:00:00 2001 From: yumaojun <719118794@qq.com> Date: Tue, 1 Dec 2015 11:20:43 +0800 Subject: [PATCH] sudo push --- jperm/ansible_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jperm/ansible_api.py b/jperm/ansible_api.py index 27d61f0e9..3d292a67f 100644 --- a/jperm/ansible_api.py +++ b/jperm/ansible_api.py @@ -286,7 +286,7 @@ class Tasks(Command): push the ssh authorized key to target. """ module_args = 'user="%s" key="{{ lookup("file", "%s") }}" state=present' % (user, key_path) - self.__run(module_args, "authorized_key") + self.__run(module_args, "authorized_key", become=True) return {"status": "failed", "msg": self.msg} if self.msg else {"status": "ok"} @@ -329,7 +329,7 @@ class Tasks(Command): module_args = 'name=%s shell=/bin/bash password=%s' % (username, encrypt_pass) else: module_args = 'name=%s shell=/bin/bash' % username - self.__run(module_args, "user") + self.__run(module_args, "user", become=True) return {"status": "failed", "msg": self.msg} if self.msg else {"status": "ok"}