是否有一个python模块可以自动化跨平台的系统配置?

时间:2022-12-07 12:17:24

I work on a lot of different systems - many linux distributions, windows (with cygwin), osx, bsd, etc.

我在许多不同的系统上工作——许多linux发行版、windows(带有cygwin)、osx、bsd等等。

I hate manually setting up each environment and have been considering for awhile now, working on a python module that will automate things like setting up a bash environment, configuring git, configuring virtual environments, configuring applications across different platforms, etc.

我讨厌手动设置每个环境,并且已经考虑了一段时间了,我正在开发一个python模块,它可以自动设置bash环境、配置git、配置虚拟环境、跨不同平台配置应用程序等等。

My idea for this is to create a python module takes a git url as a parameter, in that git repo would be a configuration file that specifies some 'meta' commands that would be performed by the parser, such as:

我的想法是创建一个python模块以一个git url作为参数,在这个git repo中,将是一个配置文件,它指定了一些由解析器执行的“元”命令,例如:

  1. Determine operating system type
  2. 确定操作系统类型
  3. Perform actions like 'apt-get install '
  4. 执行“apt-get install”之类的操作
  5. Symlink files from the repository into configuration-file based locations, based on the operating system type
  6. 根据操作系统类型,将存储库中的Symlink文件转换为基于配置文件的位置。
  7. Modify exiting system configuration files using some sort of regex parser
  8. 使用某种regex解析器修改现有的系统配置文件

Does anything like this already exist? Good idea? Bad idea? Ideas for improvements?

这样的事情已经存在了吗?好主意吗?坏主意?改进的想法?

3 个解决方案

#1


1  

I'm not sure I've seen it used as a module, but ansible is a tool written in Python that will do all these things. The 'meta' commands are in yaml files.

我不确定我是否见过它被用作模块,但是ansible是用Python编写的一个工具,它可以做所有这些事情。“meta”命令在yaml文件中。

It's usually run from the command line though, not as an imported module.

不过,它通常是从命令行运行的,而不是作为导入的模块运行。

#2


1  

There's also Puppet (Puppet Configuration Management)

还有Puppet (Puppet配置管理)

#3


1  

Saltstack, like ansible, is a set of tools to configure remote machines. It is written in python, and can be used via a python API if you so desire. The advantage salt has over ansible is that salt can configure Windows machines as well as *nix-type machines.

与ansible一样,Saltstack也是一组配置远程机器的工具。它是用python编写的,如果您愿意,可以通过python API使用它。salt相对于ansible的优势是,salt可以配置Windows机器和xx型机器。

Here is a really brief example from their documentation:

以下是他们文件中一个非常简短的例子:

import salt.client

local = salt.client.LocalClient()
local.cmd('*', 'test.fib', [10])

For more information see:

更多信息见:

#1


1  

I'm not sure I've seen it used as a module, but ansible is a tool written in Python that will do all these things. The 'meta' commands are in yaml files.

我不确定我是否见过它被用作模块,但是ansible是用Python编写的一个工具,它可以做所有这些事情。“meta”命令在yaml文件中。

It's usually run from the command line though, not as an imported module.

不过,它通常是从命令行运行的,而不是作为导入的模块运行。

#2


1  

There's also Puppet (Puppet Configuration Management)

还有Puppet (Puppet配置管理)

#3


1  

Saltstack, like ansible, is a set of tools to configure remote machines. It is written in python, and can be used via a python API if you so desire. The advantage salt has over ansible is that salt can configure Windows machines as well as *nix-type machines.

与ansible一样,Saltstack也是一组配置远程机器的工具。它是用python编写的,如果您愿意,可以通过python API使用它。salt相对于ansible的优势是,salt可以配置Windows机器和xx型机器。

Here is a really brief example from their documentation:

以下是他们文件中一个非常简短的例子:

import salt.client

local = salt.client.LocalClient()
local.cmd('*', 'test.fib', [10])

For more information see:

更多信息见: