简体   繁体   中英

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?

I'd love to know a generic answer but my two systems of most interest at the moment are RHEL and 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. How to check what installed by 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).

For Debian (and derivatives) the list of installed packages is available via 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).

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. The Applications folder another.

For brew on OS X the list of installed packages is available via brew list . For macports on OS X the list of installed packages is available via port installed .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM