Commit bf98aa54 authored by yumaojun's avatar yumaojun

sudo push

parent f3102e3b
...@@ -286,7 +286,7 @@ class Tasks(Command): ...@@ -286,7 +286,7 @@ class Tasks(Command):
push the ssh authorized key to target. push the ssh authorized key to target.
""" """
module_args = 'user="%s" key="{{ lookup("file", "%s") }}" state=present' % (user, key_path) 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"} return {"status": "failed", "msg": self.msg} if self.msg else {"status": "ok"}
...@@ -329,7 +329,7 @@ class Tasks(Command): ...@@ -329,7 +329,7 @@ class Tasks(Command):
module_args = 'name=%s shell=/bin/bash password=%s' % (username, encrypt_pass) module_args = 'name=%s shell=/bin/bash password=%s' % (username, encrypt_pass)
else: else:
module_args = 'name=%s shell=/bin/bash' % username 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"} return {"status": "failed", "msg": self.msg} if self.msg else {"status": "ok"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment