我如何在python中自动化远程部署

时间:2023-01-15 11:22:55

I want to automate the remote deploymemnet which currently i am doing manually.

我想自动化当前我手动执行的远程deploymemnet。

The Process includes

该过程包括

  1. Make the tar ball from certain folders
  2. 从某些文件夹中制作tar球

  3. SFTP to remote server
  4. SFTP到远程服务器

  5. Rename the old folders
  6. 重命名旧文件夹

  7. untar the new tar file
  8. 解压新的tar文件

  9. Restart apache

Remote system is on intranet and have no access to outside internet

远程系统位于Intranet上,无法访问外部Internet

I want to know how can i transfer the file from my python script and then when transfer is complete then log into ssh and do stuff. I am confused how can i achieve that. on local host and i can do all that but how can i do that on remote host

我想知道如何从我的python脚本传输文件,然后在传输完成后再登录ssh并执行操作。我很困惑,我怎么能实现这一点。在本地主机上,我可以做到这一切,但我怎么能在远程主机上做到这一点

1 个解决方案

#1


0  

For simple&dirty work you can use fabric (This by no means say that you cannot use fabric to build serious product)

对于简单和肮脏的工作,你可以使用面料(这绝不是说你不能使用面料来构建严肃的产品)

For heavy configuration routines, you'd better pick a CMS (e.g., ansible)

对于繁重的配置例程,您最好选择一个CMS(例如,ansible)

#1


0  

For simple&dirty work you can use fabric (This by no means say that you cannot use fabric to build serious product)

对于简单和肮脏的工作,你可以使用面料(这绝不是说你不能使用面料来构建严肃的产品)

For heavy configuration routines, you'd better pick a CMS (e.g., ansible)

对于繁重的配置例程,您最好选择一个CMS(例如,ansible)