Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python cassandra installer #7

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d4f59c0
Add ssl options and configuration
tkuhlman Dec 1, 2014
76937af
Added missing dependencies in the galaxy metadata
tkuhlman Dec 9, 2014
2b24ac6
Force flushing so state is correct even after the play fails
tkuhlman Dec 16, 2014
841d389
Bumped influxdb version up to 0.8.1
tkuhlman Dec 17, 2014
bd60d3b
Added the option to use apt to install.
tkuhlman Jan 12, 2015
dd28132
Make the influxdb hostname configurable.
tkuhlman Jan 16, 2015
dc253eb
Merge pull request #1 from hpcloud-mon/feature/listen
davidschroeder Jan 16, 2015
0732fa0
Removed functionality to allow for changing hostname.
tkuhlman Jan 22, 2015
7eb9b8d
Added the skip_install variable
tkuhlman Feb 25, 2015
1bc000e
Make the bind address configurable
tkuhlman Mar 12, 2015
0272128
Add support for InfluxDB 0.9.0
davidschroeder Mar 12, 2015
b40d818
Be smart about what host to wait for the port on.
tkuhlman Mar 12, 2015
afa5936
Switch to version_compare
davidschroeder Mar 13, 2015
ea9476a
Minor version_compare change
davidschroeder Mar 16, 2015
b66c943
Added a 2nd restart as sometimes workers don't join the cluster
tkuhlman Mar 18, 2015
fd47d60
Add support for InfluxDB 0.9.0
davidschroeder Mar 12, 2015
3bc27f3
Switch to version_compare
davidschroeder Mar 13, 2015
3a9e41c
Minor version_compare change
davidschroeder Mar 16, 2015
2320a8b
Switched to influxdb_version for better reuse and to match ansible be…
tkuhlman Mar 18, 2015
9e5e26e
Merge branch 'feature/influx0.9.0-support' of github.com:hpcloud-mon/…
tkuhlman Mar 18, 2015
2cc756d
Merge pull request #3 from hpcloud-mon/feature/cluster-issue
Mar 18, 2015
a7eac4f
Merge pull request #2 from hpcloud-mon/feature/influx0.9.0-support
joe-keen Mar 19, 2015
3e67f39
Added support for influx init script on systemd machines.
Mar 30, 2015
dc38612
Merge pull request #4 from hpcloud-mon/influx-systemd
Mar 30, 2015
fd81bd6
added join-urls for version 9 clustering
Apr 1, 2015
1e21821
Merge pull request #5 from hpcloud-mon/influx-systemd
tkuhlman Apr 1, 2015
ab8f55b
Adding the ability to bind to an address in influx 9
Apr 6, 2015
0cb14a7
Merge pull request #6 from hpcloud-mon/feature/bindAddress
joe-keen Apr 6, 2015
f1a609c
On a systemd system, we need to reload before starting
craigbr Apr 7, 2015
2d5f0af
Merge pull request #7 from craigbr/master
tkuhlman Apr 8, 2015
18998d0
Updated doc on join_urls
tkuhlman Apr 9, 2015
6d809b1
incorporated latest conf file from rc22
Apr 10, 2015
a2ba563
cleanups to original rc22 conf file
Apr 10, 2015
81af436
Set port to be configurable
tkuhlman Apr 10, 2015
bf14ffe
Merge pull request #9 from hpcloud-mon/feature/port
Apr 10, 2015
726a124
removed nasty quotes
Apr 10, 2015
da2ab50
Removed 2nd wait since we are not using 0.8 anymore.
tkuhlman Apr 10, 2015
9054bf3
removed port from broker and data to match master influxdb config file
Apr 13, 2015
c1a2f15
Fixed ordering of flush handlers
tkuhlman Apr 13, 2015
20ecf7c
Merge pull request #10 from hpcloud-mon/feature/no_more_0.8
Apr 13, 2015
a5f6d20
cleanup ssl for 0.9
Apr 13, 2015
7f82128
Remove trailing whitespace
craigbr May 20, 2015
8bb0579
Add retry for fetching package
craigbr Jun 17, 2015
5e7deb1
Add run_mode to influxdb
Jun 17, 2015
0a557d9
Fix spacing in main
Jun 17, 2015
3dfeff7
Make it work if the file had already been downloaded
craigbr Jun 18, 2015
36b465a
Merge pull request #12 from craigbr/master
tkuhlman Jun 19, 2015
df23284
Merge pull request #11 from hpcloud-mon/feature/run_mode
tkuhlman Jun 19, 2015
1c4afa2
Adding in new config for influxdb 0.9.0 release
Jun 21, 2015
d7a90ad
Default the version to 0.9.0
tkuhlman Jun 22, 2015
03cdd22
Removed influxdb 0.8.x support and other misc cleanup.
tkuhlman Jun 22, 2015
3ec1590
Enable clustering for influx 0.9.0
tkuhlman Jun 22, 2015
4e44d22
From Nicholas Randon - For single node peers should be undefined.
tkuhlman Jun 30, 2015
98ad2d9
Remove trailing space
craigbr Jul 2, 2015
8ecf8d0
Merge pull request #14 from craigbr/master
craigbr Jul 2, 2015
95914c3
Update to 0.9.1
tkuhlman Jul 2, 2015
af6ef4d
Merge pull request #13 from hpcloud-mon/feature/influxdb9config
Jul 6, 2015
51efe01
Have influxdb_bind_address used for all bind config lines
craigbr Jul 24, 2015
0354600
Added influxdb_bind_address to README
craigbr Jul 27, 2015
e789b48
Merge pull request #15 from craigbr/master
tkuhlman Jul 27, 2015
0ab387a
Add support for RedHat
zielonkam May 14, 2015
8cb9f4f
Merge pull request #18 from FujitsuEnablingSoftwareTechnologyGmbH/master
tkuhlman Aug 20, 2015
2d0e744
Update config template
srisakha Oct 8, 2015
271d7a0
Update config template
srisakha Oct 8, 2015
b0b64e2
Merge branch 'master' of https://github.com/srsakhamuri/ansible-influxdb
srisakha Oct 9, 2015
ca6cf65
Merge pull request #19 from srsakhamuri/master
Oct 13, 2015
81bc893
add bool filter to when statements
Nov 13, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
InfluxDB
========
# InfluxDB

Install [InfluxDB](http://influxdb.org/) time series database

Role Variables
--------------

`defaults/main.yml`
## Role Variables

| Name | Default Value | Description |
|-----------------------------|---------------|------------------------------------------------------------------|
| influxdb.version | 0.5.4 | Version to install |
| influxdb.raft_port | [8090] | Port used for raft |
| influxdb.seed_servers | [] | List of host:port to use as cluster seed servers |
| influxdb.replication_factor | 1 | How many servers in the cluster should have a copy of each shard |
| influxdb_client_port | 8086 | The port for influxdb client connections |
| influxdb_ssl_certificate | None | If defined the influxdb_client_port will be set to SSL |
| influxdb_ssl_certificate_src| None | If defined the file at this location wil be copied to the host |
| influxdb_use_apt | false | If true apt will be used to install influxdb |
| influxdb_deb_src_url | http://s3.amazonaws.com/influxdb/ | If not using apt the url base to pull the deb from |


Example Playbook
-------------------------
##Optional
- influxdb_bind_address - address to be used for binding the influxdb ports. Default is to bind to all IP addresses.
- run_mode - One of Deploy, Stop, Install, Start, or Use. The default is Deploy which will do Install, Configure, then Start.

- hosts: servers
roles:
- stympy.influxdb
### Clustering
To enable clustering define `influxdb_peers` on all nodes.
`influxdb_peers` is a list of `host:port` entries, one for each node.

License
-------
## License

MIT

Author Information
------------------

Benjamin Curtis <[email protected]>
27 changes: 21 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
influxdb:
version: 0.5.4
raft_port: 8090
seed_servers: [ ]
replication_factor: 1
influxdb_client_port: 8086
influxdb_client_port: 8086
influxdb_raft_port: 8088
influxdb_hostname: "{{ ansible_default_ipv4.address }}"

influxdb_use_apt: false
# Url to find the influxdb deb, the deb name/version is appended, only used if not using apt
influxdb_deb_src_url: http://s3.amazonaws.com/influxdb

influxdb_versions:
RedHat: 0.9.1-1
Debian: 0.9.1

influxdb_version: "{{ influxdb_versions[ansible_os_family] }}"

run_mode: Deploy
skip_install: False

download_tmp_dir: "/opt/monasca_download_dir"
influxdb_log_dir: "/var/log/influxdb"

verify: True
4 changes: 0 additions & 4 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
- name: restart influxdb
service: name=influxdb state=restarted

- name: wait for influxdb port
wait_for: port={{influxdb_client_port}} state=started

8 changes: 6 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
galaxy_info:
author: Benjamin Curtis
description: Install InfluxDB Time Series Database
author: Tim Kuhlman
description: Install InfluxDB Time Series Database - Originally based on the version by Benjamin Curtis
license: MIT
min_ansible_version: 1.3
platforms:
Expand All @@ -11,6 +11,10 @@ galaxy_info:
- name: Debian
versions:
- all
- name: RedHat
versions:
- all
categories:
- database
- database:nosql
dependencies: []
22 changes: 22 additions & 0 deletions tasks/DebianInst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- name: apt install influxdb
apt: name=influxdb
when: influxdb_use_apt

- name: Create download directory
file: path="{{ download_tmp_dir }}" state=directory recurse=yes
when: not influxdb_use_apt

- name: Fetch package
get_url: url={{influxdb_deb_src_url}}/influxdb_{{ influxdb_version }}_amd64.deb
dest={{ download_tmp_dir }}/influxdb_{{ influxdb_version }}_amd64.deb
register: get_url_result
until: get_url_result.state == 'file'
retries: 5
delay: 1
when: not influxdb_use_apt

- name: Install package
command: dpkg --skip-same-version -i {{ download_tmp_dir }}/influxdb_{{ influxdb_version }}_amd64.deb
register: dpkg_result
changed_when: "dpkg_result.stdout.startswith('Selecting')"
when: not influxdb_use_apt
13 changes: 13 additions & 0 deletions tasks/RedHatInst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Create download directory
file: path="{{ download_tmp_dir }}" state=directory recurse=yes

- name: Fetch package
get_url: url={{influxdb_deb_src_url}}/influxdb-{{ influxdb_version }}.x86_64.rpm
dest={{ download_tmp_dir }}/influxdb-{{ influxdb_version }}.x86_64.rpm
register: get_url_result
until: get_url_result.state == 'file'
retries: 5
delay: 1

- name: Install package
yum: name="{{ download_tmp_dir }}"/influxdb-{{ influxdb_version }}.x86_64.rpm state=present
31 changes: 31 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Update config
template: src=influxdb.conf.j2 dest=/etc/opt/influxdb/influxdb.conf
when: influxdb_version|version_compare('0.9', '>=')
notify:
- restart influxdb

- name: Prepare custom influxdb config
template: src=etc_default_influxdb.j2 dest=/etc/default/influxdb
when: influxdb_version|version_compare('0.9', '>=')
notify:
- restart influxdb

- name: Copy ssl key
copy: dest={{influxdb_ssl_certificate}} src={{influxdb_ssl_certificate_src}} owner=influxdb group=root mode=0440
when: influxdb_ssl_certificate_src is defined
notify:
- restart influxdb

- name: Detect if this is a systemd based system
command: cat /proc/1/comm
register: init
- set_fact: use_systemd=True
when: init.stdout == 'systemd'
- set_fact: use_systemd=False
when: init.stdout != 'systemd'

- command: systemctl daemon-reload
when: use_systemd

- meta: flush_handlers
6 changes: 6 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- include: DebianInst.yml
when: "ansible_os_family == 'Debian'"

- include: RedHatInst.yml
when: "ansible_os_family == 'RedHat'"
30 changes: 9 additions & 21 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
- name: Fetch package
get_url: url=http://s3.amazonaws.com/influxdb/influxdb_{{ influxdb.version }}_amd64.deb dest=/usr/local/src/influxdb_{{ influxdb.version }}_amd64.deb
---
- include: stop.yml
when: run_mode == 'Stop'

- name: Install package
command: dpkg --skip-same-version -i /usr/local/src/influxdb_{{ influxdb.version }}_amd64.deb
register: dpkg_result
changed_when: "dpkg_result.stdout.startswith('Selecting')"
- include: install.yml
when: not skip_install and ( run_mode == 'Install' or run_mode == 'Deploy' )

- name: Check for ip address in config file
command: grep -E '^\s*hostname.*{{ ansible_default_ipv4.address }}' /opt/influxdb/shared/config.toml
register: config_has_ip
ignore_errors: true
changed_when: false
- include: configure.yml
when: run_mode == 'Configure' or run_mode == 'Deploy'

- name: Delete raft dir before hostname change
file: dest=/opt/influxdb/shared/data/raft state=absent
when: config_has_ip|failed

- name: Update config
template: src=config.toml dest=/opt/influxdb/shared/config.toml
notify:
- restart influxdb
- wait for influxdb port

- include: start.yml
when: run_mode == 'Start' or run_mode == 'Deploy'
8 changes: 8 additions & 0 deletions tasks/start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Enable and start influxdb
service: name=influxdb state=started enabled=yes

- name: wait for influxdb port
wait_for: port={{influxdb_client_port}} host={{influxdb_bind_address | default('127.0.0.1') }} state=started timeout=180
register: first_wait
when: verify | bool
3 changes: 3 additions & 0 deletions tasks/stop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Stop influxdb
service: name=influxdb state=stopped
157 changes: 0 additions & 157 deletions templates/config.toml

This file was deleted.

2 changes: 2 additions & 0 deletions templates/etc_default_influxdb.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Logging
STDERR="{{ influxdb_log_dir }}/influxd.log"
Loading