Ansible playbook for automatically deploying the Server Density agent.
Ansible >= 1.8
- Debian/Ubuntu
- Redhat/CentOS
This playbook will install the Server Density agent, allowing for custom configuration and server grouping.
Create an API token using these directions https://apidocs.serverdensity.com/#authentication
Edit the following files.
roles/serverdensity/vars/main.yml
inventories/hosts
serverdensity.yml
There are many different ways to set or overwrite Ansible varabiles. These are only a few examples. For more information about setting varaibles, read the official Ansible Documentation.
Example Ansible command: ansible-playbook -i inventories/hosts serverdensity.yml
Example: Setting group_name
via inventories/hosts
file
[development]
hostname ansible_ssh_host=ip_of_host
[development:vars]
group_name=development_servers
Example: Setting group_name
via role parameter
- hosts: development
gather_facts: yes
sudo: yes
roles:
- { role: serverdensity, group_name: "development_servers" }
Example: Setting group_name
and other varaibles via playbook vars
- hosts: development
gather_facts: yes
sudo: yes
vars:
group_name: "development_servers"
mysql_server: "localhost"
mysql_user: "root"
mysql_pass: "password"
roles:
- serverdensity
You are not requried to update these variables in order to get the Server Density agent running. You can however overwrite these variables in your playbook should you choose to do so.
group_name: "ungrouped"
plugin_directory: ""
apache_status_url: "http://www.example.com/server-status/?auto"
apache_status_user:
apache_status_pass:
fpm_status_url: ""
mongodb_server: ""
mongodb_dbstats: "no"
mongodb_replset: "no"
mysql_server: ""
mysql_user: ""
mysql_pass: ""
nginx_status_url: "http://www.example.com/nginx_status"
rabbitmq_status_url: "http://www.example.com:55672/json"
rabbitmq_user: "guest"
rabbitmq_pass: "guest"
tmp_directory: ""
pidfile_directory: ""
logging_level: ""
group_name
- Sets the group nameplugin_directory:
- Sets the directory the agent looks for plugins, if left blank it is ignoredapache_status_url:
- URL to get the Apache2 status page from (e.g.mod_status
)apache_status_user:
- Username to authenticate to the Apache2 status page, required ifapache_status_url
is setapache_status_pass:
- Password to authenticate to the Apache2 status page, required ifapache_status_url
is setfpm_status_url:
- URL to get the PHP-FPM status page from, disabled if not setmongodb_server:
- Server to get MongoDB status monitoring from, this takes a full MongoDB connection URI so you can set username/password etc. details here if needed, disabled if not setmongodb_dbstats:
- Enables MongoDB stats ifyes
andmongodb_server
is setmongodb_replset:
- Enables MongoDB replset stats ifyes
andmongodb_server
is setmysql_server:
- Server to get MySQL status monitoring from, disabled if not setmysql_user:
- Username to authenticate to MySQL, required ifmysql_server
is setmysql_pass:
- Password to authenticate to MySQL, required ifmysql_server
is setnginx_status_url:
- URL to get th Nginx status page fromrabbitmq_status_url:
- URL to get the RabbitMQ status from via HTTP management APIrabbitmq_user:
- Username to authenticate to the RabbitMQ management API, required ifrabbitmq_status_url
is setrabbitmq_pass:
- Password to authenticate to the RabbitMQ management API, required ifrabbitmq_status_url
is settmp_directory:
- Override where the agent stores temporary files, system default tmp will be used if not setpidfile_directory:
- Override where the agent stores it's PID file, temp dir (above or system default) is used if not set