The omniversion Ansible collection contains roles and playbooks to fetch versions and dependency information from servers orchestrated via Ansible.
ansible-galaxy collection install layer9gmbh.omniversion
Simply run the playbook layer9gmbh.omniversion.fetch
in your project's directory (or wherever Ansible can pick up your host definitions):
ansible-playbook layer9gmbh.omniversion.fetch
Package managers installed on each host will be detected automatically and all global package information will be fetched.
To fetch local dependencies as well, you will need to add some configuration so that omniversion
knows which directories to look in.
Configure your package managers via the var_omniversion
variable. It is a dictionary/map with the following values:
Key | Value |
---|---|
apt |
Advanced packaging tool options |
auto |
auto-detection options |
galaxy |
Ansible Galaxy options |
custom |
custom command fetcher options (fetch unmanaged package versions) |
file |
file fetcher options (fetch versions from configuration files) |
go |
go modules options |
brew |
homebrew options |
npm |
Node package manager options |
nvm |
Node version manager options |
pip |
package installer for Python options |
gem |
rubygems options |
rvm |
Ruby version manager options |
var_omniversion:
# turn off auto-detection so omniversion will only attempt to use the package managers explicitly configured
auto: false
# enable Aptitude
apt: true
# enable npm with local dependencies
npm:
global: true
local:
- '/srv/foobar/current/frontend'
- '/srv/foobar2/current/frontend'
# enable rvm
rvm: true
The results of all omniversion/ansible
runs are stored in temp files on the localhost (i.e. the control node). Use the var_omniversion_output_dir
variable to control the directory. The default value is /tmp/omniversion
.
This should be the same for all hosts. omniversion/ansible
will automatically create subdirectories and store files separated by host, package manager and role, so that the --tag
and --limit
Ansible options can be used without overwriting unrelated data.
var_omniversion_output_dir: ~/Documents/testortestington/foobar/tmp/omniversion
The omniversion/ansible
collection contains both roles and playbooks. You can either include one of the roles in a playbook or simply run a playbook directly.
The following are available as both roles and playbooks of the same name:
Role/playbook name | Description |
---|---|
layer9gmbh.omniversion.audit |
Fetches security notices by running the audit (or equivalent) command on each host (only applicable for package managers that offer this functionality). |
layer9gmbh.omniversion.fetch |
Fetches all available data by executing all other omniversion roles in turn. |
layer9gmbh.omniversion.list |
Fetches currently installed dependencies by running the list (or equivalent) command on each host. |
layer9gmbh.omniversion.outdated |
Fetches available updates by running the outdated (or equivalent) command on each host. |
layer9gmbh.omniversion.refresh |
Updates the package manager caches by running the update (or equivalent) command on each host. |
layer9gmbh.omniversion.version |
Fetches versions not controlled by any package manager (including versions of package managers themselves) on each host. |
In addition, two internally used roles do not have an associated playbook, as you usually don't need to call them individually:
layer9gmbh.omniversion.check
verifies that theomniversion
CLI is installed on the control node.layer9gmbh.omniversion.autodetect
determines which package managers are available on each host.
ansible-galaxy collection install layer9gmbh.omniversion --force
ansible-galaxy
offers no uninstall command, but you can simply delete the layer9gmbh.omniversion
folder in your
Ansible collections directory.