Skip to content
Snippets Groups Projects
Commit 9d0da455 authored by jurgenhaas's avatar jurgenhaas
Browse files

Update readme

parent ffced5ad
No related branches found
No related tags found
No related merge requests found
Setup ServerDensity by Ansible
==============================
Ansible plugin for ServerDensity
================================
This script is both using the API from ServerDensity and from Ansible.
This is an Ansible[1] plugin to manage your Ansible inventory over at Server Density[2]. It uses the APIs from ServerDensity[3] and from Ansible[4].
It currently creates a node at ServerDensity for each host in you Ansible
inventory and by using the Ansible facts, those nodes get as much detail as
available and allowed by the Server Density API.
##Features##
Future plans are to also create services and alerts from variables being
defined in the Ansible inventory.
The following objects can be created and updated in your Server Density account from within Ansible:
* Hosts/Devices with groups
* Services with groups
* Alerts for
* Devices
* Device Groups
* Services
* Service Groups
* Notifications for alerts
There are plugin parameters to define how the plugin will behave:
**api_token**: An API token from Server Density to authenticate yourself
**force** (optional, defaults to False): If an object already exists whether it should be updated
**cache** (optional, defaults to None): Fully qualified filename for a cache of der Server Density data
**cleanup** (optional, defaults to False): Decides if undefined alerts in your Ansible inventory available at Server Density should be deleted
##Installation##
Download (or clone) the file serverdensity from the action_plugins directory and copy that into your custom action plugins directory which is defined in /etc/ansible/ansible.cfg. The default location for this is /usr/share/ansible_plugins/action_plugins
##Usage##
Just clone the script ansible-serverdensity.py and run it, the possible
parameters are similar to those of Ansible in general and will be displayed
at the console.
This plugin can be used in playbooks or with the ansible script directly.
###In Playbooks###
Simply include a task like this:
```
- name: 'ServerDensity | Init SD plugin'
local_action: serverdensity
api_token={{sd_api_token}}
cleanup=true
cache='/tmp/my_sd_cache'
```
You may also be interested in a Server Density role[5] that I've written which in addition installs and configures the Server Density agent on your hosts and works in conjunction with this plugin as well.
###From the ansible script###
Your whole inventory gets synchronized with Server Density simply by using this command:
With no parameters given, the default inventory on your system will be used.
```
ansible all -m serverdensity -a 'api_token=YOUR_TOPKEN_FROM_SD' -vv
```
There are several ways to make available the API Token from ServerDensity:
The final -vv parameter is inhancing the level of output on the console and with this plugin you'll get some quite useful information on what's going on in detail.
* Command line parameter: **-A**
* As a variable in your inventory: **sd_api_token**
* As an environment variable: **SD_API_TOKEN**
[1]: http://www.ansible.com
[2]: https://www.serverdensity.com
[3]: https://apidocs.serverdensity.com
[4]: http://docs.ansible.com/index.html
[5]: https://github.com/jurgenhaas/ansible-role-serverdensity
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment