[英]How to gather all facts on an unknown machine with Ansible?
If I start managing a relatively unknown machine, what is the easiest/best way with Ansible and/or Bash or Python to quickly find out what things are installed and what versions? 如果我开始管理一个相对未知的机器,那么使用Ansible和/或Bash或Python来最容易/最好的方法是什么,以快速找出已安装的东西和什么版本?
I'd love to know a generic answer but my two systems of most interest at the moment are RHEL and Mac OSX. 我很想知道一个通用的答案,但是目前我最感兴趣的两个系统是RHEL和Mac OSX。
thank you! 谢谢! ps This SO post only describes how to list what is installed by ansible, ie after I would have taken over. ps此SO帖子仅描述如何列出ansible所安装的内容,即在我接管之后。 How to check what installed by Ansible? 如何检查Ansible安装了什么?
For RedHat (and derivatives) the list of installed packages is available via rpm -qa
(you probably want to add | sort
to that for sanity purposes). 对于RedHat(及其衍生产品),可通过rpm -qa
获得已安装软件包的列表(出于理智的考虑,您可能希望在其中添加| sort
)。
For Debian (and derivatives) the list of installed packages is available via dpkg -l
. 对于Debian(及其衍生产品),可通过dpkg -l
获得已安装软件包的列表。
Those only list package installed software. 这些仅列出软件包安装的软件。 Anything compiled/installed manually will not be in that list and there isn't an easy way to get a list of what those things might be (though looking in /usr/local
and /opt
are good places to start). 手动编译/安装的任何内容都不会在该列表中,并且没有一种简单的方法来获得这些内容的列表(尽管在/usr/local
和/opt
中查找是个不错的起点)。
I don't know of a way to get that sort of list for OS X. Though I imagine the App Store might be a place to start. 我不知道如何获得OS X这样的列表。尽管我认为App Store可能是一个起点。 The Applications folder another. Applications文件夹另一个。
For brew
on OS X
the list of installed packages is available via brew list
. 对于OS X
的brew
,可通过brew list
获得已安装软件包的brew list
。 For macports
on OS X
the list of installed packages is available via port installed
. 对于OS X
的macports
,可通过port installed
安装软件包的列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.