一个ssh-python自动化工具,用于快速完成任务
publicServerAutomator的Python项目详细描述
公共服务器自动机
v1.0.0
目的
这是一个软件包,旨在提供一个更简单、无障碍、无学习曲线的软件包+Ansible/Chef/Puppet的替代软件
安装
通过PIP安装
pip install publicServerAutomator
用法
使用私钥时
import Server from publicServerAutomator
dockerInstructions = [
"apt-get update -y",
"apt-get install apt-transport-https -y",
"apt-get install software-properties-common -y",
"apt-get install curl -y",
"apt-get install gnupg2 -y",
"apt-get install git -y",
"apt-get install acl -y",
"apt-get install fail2ban -y"
'''add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"''',
"apt-get update -y",
"apt-get install docker-ce -y",
"docker run hello-world"
]
newDocker = server.Server(inputKeyPath="publickey.pem", inputKeyPassword='PASS', inputServerIP="0.0.0.0" )
newDocker.set_commands(commandList=dockerInstructions)
newDocker.connect()
newDocker.run_commands()
不使用私钥
import Server from publicServerAutomator
dockerInstructions = [
"apt-get update -y",
"apt-get install apt-transport-https -y",
"apt-get install software-properties-common -y",
"apt-get install curl -y",
"apt-get install gnupg2 -y",
"apt-get install git -y",
"apt-get install acl -y",
"apt-get install fail2ban -y"
'''add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"''',
"apt-get update -y",
"apt-get install docker-ce -y",
"docker run hello-world"
]
newDocker = server.Server(inputServerIP='8.8.8.8',inputUserName='root', inputPassword='123lookatme')
newDocker.set_commands(commandList=dockerInstructions)
newDocker.connect()
newDocker.run_commands()