Skip to content

Latest commit

 

History

History
156 lines (117 loc) · 7.42 KB

README.md

File metadata and controls

156 lines (117 loc) · 7.42 KB

Collectd

Ansible Galaxy Build Status CodeClimate IssueCount

Table of Contents

  1. Overview
  2. Requirements
  3. Role Variables
  4. Dependencies
  5. Examples
  6. Development / Contributing
  7. License
  8. Author Information

Overview

Collectd Installation and Configuration

Requirements

This role requires Ansible 2.3 or higher and platform requirements are listed in the metadata file.

Role Variables

Variables listed in main/defaults.yml with no value are considered to have a value of 'none'. If these variables are left unset, they are assigned a value from the collectd_variables_overrides task using the set_fact Ansible module. The values are obtained from the collectd role variables in /vars/* based on the OS family.

The variables that can be passed to this role and a brief description about them are as follows. (For all variables, take a look at defaults/main.yml)

Name Default Type Description
collectd_service_name collectd String Name of the collectd service
collectd_packages See role variables (/vars) Array List of packages
collectd_version See role variables (/vars) String Version of the collectd package(s) to install
collectd_yum_repo_baseurl See role variables (/vars) String YUM repository base url
collectd_yum_repo_rpm_key See role variables (/vars) String YUM repository RPM Key
collectd_yum_repo_enabled See role variables (/vars) Boolean Enable YUM repository
collectd_config_file See role variables (/vars) String Configuration file location
collectd_config_owner root String Configuration file(s) owner
collectd_config_group See role variables (/vars) String configuration file(s) group
collectd_config_mode 0640 Int Configuration file(s) mode
collectd_plugin_conf_dir See role variables (/vars) String Plugins directory
collectd_plugin_conf_dir_mode 0750 Int Plugins directory mode
collectd_plugin_conf_order 10 Int Plugin file prefix, to set load order when available
collectd_conf_autoloadplugin false Boolean Set the AutoLoadPlugin value in the collectd configuration
collectd_config_typesdb None Array Set the TypesDB value(s) in the collectd configuration
collectd_config_typesdb_defaults See role variables (/vars) Array Set the default TypesDB value(s) merged with the values from collectd_config_typesdb
collectd_config_write_queue_limit_high See role variables (/vars) String Enable/Set the WriteQueueLimitHigh value in the collectd configuration
collectd_config_write_queue_limit_low See role variables (/vars) String Enable/Set the WriteQueueLimitLow value in the collectd configuration
collectd_config_interval 60 Int Set the Interval value in the collectd configuration
collectd_config_timeout 2 Int Set the Timeout value in the collectd configuration
collectd_config_read_threads 5 Int Set the ReadThreads value in the collectd configuration
collectd_config_write_threads 5 Int Set the WriteThreads value in the collectd configuration
collectd_plugins See Collectd Plugins below Array of Dictionaries Manage/Configure plugins and values
collectd_disabled_plugins [] Array List of plugins and should be disabled and configuration file(s) removed

Collectd Plugins

This role provides several methods for managing/configuring Collectd plugins.

Basic

You can override the collectd_plugins variable as a single configuration within your projects host/group variables when calling this role from within your projects playbook

## Playbook reference
roles:
    - {role: ansible-role-collectd}

## Host/Group variable reference
collectd_plugins:
  - name: logfile
    order: '00'
    options:
      LogLevel: "info"
      File: "/var/log/collectd.log"
      Timestamp: true
      PrintSeverity: false

Nested Variables

You can also override the collectd_plugins variable by nesting multiple variables per plugin.

See the example below where the collectd_plugin_logfile plugin is nested within the collectd_plugins variable. Allowing you to override just the collectd_plugin_logfile as needed based on host/group without the need to manage the entire collectd_plugins variable block

collectd_plugin_logfile:
  - name: logfile
    order: '00'
    options:
      LogLevel: "info"
      File: "/var/log/collectd.log"
      Timestamp: true
      PrintSeverity: false

collectd_plugins:
  "{{ collectd_plugin_logfile }}"

Include Role Class

You can also use the Ansible include_role module with the task_from attribute to call the plugins_class task file to manage any plugins.

This method can be used when you have included this role from within another role such as a "base" role to install/manage the collectd service and any default plugins you wish such as CPU/Memory. But have an additional role as one for your web servers that you want to manage the Apache plugin for.

tasks:
    - name: Install Collectd Disk Plugin
      include_role:
        name: ansible-role-collectd
        tasks_from: plugins_class.yml
      vars:
        - name: apache
          options:
            Instance: apache80
              URL: http://localhost/mod_status?auto
              User: collectd
              Password: hoh2Coo6

Dependencies

None

Examples

Example Playbook

See the Molecule testing Playbook for an example

Development / Contributing

See Contributing.

This role has been tested against the following distributions and Ansible version:

Distribution Ansible 2.3 Ansible 2.4 Ansible 2.5 Ansible 2.6 Notes
Centos 6 Yes Yes Yes Yes
Centos 7 Yes Yes Yes No Requires two runs to enable service with Ansible 2.6
FreeBSD 11.2 Yes Yes Yes Yes
OpenBSD 6.3 Yes Yes Yes Yes

License

Licensed under the MIT License. See the LICENSE file for details.

Author Information

  • Steven Bambling