Installs the OCS Inventory NG Agent.
After the role is run, a ocsinventory-agent
will be available on the server. You can use ocsinventory-agent
run an manual inventory.
None.
Available variables are listed below, along with default values (see defaults/main.yml
):
ocs_server: http://ocsinventory-ng/ocsinventory
The full URL of the OCS Inventory NG server where the agent should report. This usually ends in /ocsinventory
.
ocs_basedir: /var/lib/ocsinventory-agent
The working directory where the agent stores temporary or state files.
ocs_configdir: /etc/ocsinventory
The configuration directory for the agent. Configuration files and certificates will be placed here.
ocs_logfile: /var/log/ocsinventory-agent.log
The log file path where the agent will write logs.
ocs_ssl: false
Whether to use SSL Verification when communicating with the OCS server. Set to true to enable SSL.
Requires ocs_ca_file
to be set!
ocs_ca_file: ""
Path to a CA certificate file used for server verification.
ocs_ca: "{{ ocs_configdir }}/cacert.pem"
Default location where the CA certificate will be copied to on the target system. Only used if ocs_ca_file is set.
ocs_tag: ""
Optional tag to assign to the machine in OCS Inventory. Can be used for grouping or classification.
ocs_nosoftware: 0
Set to 1 to disable software inventory. By default, all installed software is reported.
ocs_no_ssl_verify: false
Set to true to disable SSL certificate verification. Not recommended for production unless using a trusted internal CA and skipping verification intentionally.
ocs_prolog_freq: 4
Defines how often the agent should contact the server, in hours.
Setting this value to 0 will disable the cron Job.
The minute when this job will be executes is randomized to lower the strain on the network.
ocs_now: true
Set to true executes an inventory task immediately after installation.
ocs_apt_release: stable
The APT release channel to use for the OCS Inventory repository (e.g., stable, oldstable).
ocs_apt_repository: "deb http://deb.ocsinventory-ng.org/{{ ansible_distribution | lower }} {{ ocs_apt_release }} main"
The full APT repository URL used to install the OCS Inventory agent.
ocs_apt_gpg_key: https://deb.ocsinventory-ng.org/pubkey.gpg
URL to the GPG key used to verify the APT repository.
None.
- hosts: server
vars_files:
- vars/main.yml
roles:
- role: niklaszerozero.ocsinventory_agent
Inside vars/main.yml
:
ocs_server: http://ocsinventory-ng/ocsinventory
ocs_ssl: true
ocs_ca_file: "files/cacert.pem"
ocs_prolog_freq: 6
MIT
This role was created in 2025 by Niklas Vlach.