juliendufresne.influxdb
Ansible Role InfluxDB
完全に設定可能な InfluxDB のインストールと管理。influxdb_users
と influxdb_databases
変数を使って、ユーザーやデータベースを管理できます。
サポートするプラットフォーム
ディストリビューション | 最終チェック日 | スクラッチからのインストール | 冪等性 |
---|---|---|---|
CentOS 7.2.1511 (Core) | 2016-08-06 18:40:07 | ||
Debian 7.10 (wheezy) | 2016-08-06 18:41:39 | ||
Debian 8.4 (jessie) | 2016-08-06 18:43:44 | ||
Ubuntu 12.04 (precise) | 2016-08-06 18:45:21 | ||
Ubuntu 14.04 (trusty) | 2016-08-06 18:47:32 | ||
Ubuntu 15.04 (vivid) | 2016-08-06 18:49:37 | ||
Ubuntu 15.10 (wily) | 2016-08-06 18:51:39 | ||
Ubuntu 16.04 (xenial) | 2016-08-06 18:53:35 |
テーブルは test-ansible-roles で生成されました。
要件
このロールは ansible 2.1.0+ を必要とします(apt_repository でファイル名を使用)。
モジュール influxdb_user
このロールには、InfluxDB ユーザーを管理するためのモジュールが含まれています。 このモジュールは以下のことができます:
- ユーザーが存在するか、または存在しないことを確認
- 管理者ユーザーまたは通常ユーザーを作成
- ユーザーのデータベースアクセス権(NO、READ、WRITE または ALL)を管理
- 指定した権限を既存のものに追加
このモジュールについての詳細は 専用のドキュメント をご覧ください。
注意: このモジュールは独立して使用することも、変数
influxdb_users
を介して使用することもできます。
ロール変数
すべての変数にはデフォルト値があります。このロールはデフォルト設定で実行できます。
グローバルオプション
名前 | 説明 | デフォルト |
---|---|---|
influxdb_install_user | インストールに使用するユーザー | "root" |
influxdb_user | InfluxDB ユーザー | "influxdb" |
influxdb_group | InfluxDB グループ | "influxdb" |
influxdb_config_dir | 設定ファイルの場所 | "/etc/influxdb" |
influxdb_config_file | 設定ファイル名 | "influxdb.conf" |
influxdb_users | ユーザー管理を許可(下記参照) | [] |
influxdb_databases | データベース管理を許可(下記参照) | ["_internal"] |
ユーザーの管理
influxdb_users
変数を使用することで、ユーザーの作成や権利管理が可能になります。
各エントリについて、スクリプトは以下を実行します:
- ユーザーが存在しない場合は作成
- パスワードが変更されている場合は更新
type
がadmin
に設定されている場合は管理者ロールを付与- 以前に定義されたデータベースの権利を取り消し
- 各データベースに指定された権限を付与
例:
influxdb_users:
- name: admin
admin: yes
password: admin
- name: grafana
password: grafana
grants: "measurement:READ" # grafana ユーザーに測定テーブルへの READ アクセスを付与
- type: user
name: telegraf
password: telegraf
grants: "measurement:WRITE" # telegraf ユーザーに測定テーブルへの WRITE アクセスを付与
- name: john
password: john
grants: "measurement:ALL" # telegraf ユーザーに測定テーブルへの READ と WRITE アクセスを付与
安全のため、データベースを削除することはありません。
データベースの管理
influxdb_databases
にリストされたデータベースが作成されているか確認します。
例:
influxdb_databases:
- "_internal"
- "grafana"
安全のため、データベースを削除することはありません。
設定ファイルオプション
設定ファイルの各パラメータは指定できます。
変数の形式: influxdb__<block-name>__<parameter_in_snake_case>
名前 | 説明 | デフォルト |
---|---|---|
influxdb_config__meta__dir | "/var/lib/influxdb/meta" | |
influxdb_config__meta__retention_autocreate | "true" | |
influxdb_config__meta__logging_enabled | "true" | |
influxdb_config__meta__pprof_enabled | "false" | |
influxdb_config__meta__lease_duration | "1m0s" | |
influxdb_config__data__enabled | "true" | |
influxdb_config__data__dir | "/var/lib/influxdb/data" | |
influxdb_config__data__wal_dir | "/var/lib/influxdb/wal" | |
influxdb_config__data__wal_logging_enabled | "true" | |
influxdb_config__data__data_logging_enabled | "true" | |
influxdb_config__data__query_log_enabled | "true" | |
influxdb_config__data__cache_max_memory_size | 524288000 | |
influxdb_config__data__cache_snapshot_memory_size | 26214400 | |
influxdb_config__data__cache_snapshot_write_cold_duration | "1h" | |
influxdb_config__data__compact_min_file_count | 3 | |
influxdb_config__data__compact_full_write_cold_duration | "24h" | |
influxdb_config__data__max_points_per_block | 1000 | |
influxdb_config__cluster__shard_writer_timeout | "5s" | |
influxdb_config__cluster__write_timeout | "10s" | |
influxdb_config__cluster__max_concurrent_queries | 0 | |
influxdb_config__cluster__query_timeout | "0s" | |
influxdb_config__cluster__max_select_point | 0 | |
influxdb_config__cluster__max_select_series | 0 | |
influxdb_config__cluster__max_select_buckets | 0 | |
influxdb_config__retention__enabled | "true" | |
influxdb_config__retention__check_interval | "30s" | |
influxdb_config__shard_precreation__enabled | "true" | |
influxdb_config__shard_precreation__check_interval | "10m" | |
influxdb_config__shard_precreation__advance_period | "30m" | |
influxdb_config__monitor__store_enabled | "true" | |
influxdb_config__monitor__store_database | "_internal" | |
influxdb_config__monitor__store_interval | "10s" | |
influxdb_config__admin__enabled | "true" | |
influxdb_config__admin__bind_address | ":8083" | |
influxdb_config__admin__https_enabled | "false" | |
influxdb_config__admin__https_certificate | "/etc/ssl/influxdb.pem" | |
influxdb_config__http__enabled | "true" | |
influxdb_config__http__bind_address | ":8086" | |
influxdb_config__http__auth_enabled | "false" | |
influxdb_config__http__log_enabled | "true" | |
influxdb_config__http__write_tracing | "false" | |
influxdb_config__http__pprof_enabled | "false" | |
influxdb_config__http__https_enabled | "false" | |
influxdb_config__http__https_certificate | "/etc/ssl/influxdb.pem" | |
influxdb_config__http__max_row_limit | 10000 | |
influxdb_config__graphite__enabled | "false" | |
influxdb_config__graphite__bind_address | ":2003" | |
influxdb_config__graphite__database | "graphite" | |
influxdb_config__graphite__protocol | "tcp" | |
influxdb_config__graphite__batch_size | 5000 | |
influxdb_config__graphite__batch_pending | 10 | |
influxdb_config__graphite__batch_timeout | "1s" | |
influxdb_config__graphite__consistency_level | "one" | |
influxdb_config__graphite__separator | "." | |
influxdb_config__graphite__udp_read_buffer | 0 | |
influxdb_config__graphite__tags | [] | |
influxdb_config__graphite__templates | [] | |
influxdb_config__collectd__enabled | "false" | |
influxdb_config__collectd__bind_address | ":25826" | |
influxdb_config__collectd__database | "collectd" | |
influxdb_config__collectd__batch_size | 5000 | |
influxdb_config__collectd__batch_pending | 10 | |
influxdb_config__collectd__batch_timeout | "10s" | |
influxdb_config__collectd__read_buffer | 0 | |
influxdb_config__collectd__typesdb | "/usr/share/collectd/types.db" | |
influxdb_config__opentsdb__enabled | "false" | |
influxdb_config__opentsdb__bind_address | ":4242" | |
influxdb_config__opentsdb__database | "opentsdb" | |
influxdb_config__opentsdb__retention_policy | "" | |
influxdb_config__opentsdb__consistency_level | "one" | |
influxdb_config__opentsdb__tls_enabled | "false" | |
influxdb_config__opentsdb__certificate | "/etc/ssl/influxdb.pem" | |
influxdb_config__opentsdb__batch_size | 1000 | |
influxdb_config__opentsdb__batch_pending | 5 | |
influxdb_config__opentsdb__batch_timeout | "1s" | |
influxdb_config__opentsdb__log_point_errors | "true" | |
influxdb_config__udp__enabled | "false" | |
influxdb_config__udp__bind_address | ":8089" | |
influxdb_config__udp__database | "udp" | |
influxdb_config__udp__retention_policy | "" | |
influxdb_config__udp__batch_size | 5000 | |
influxdb_config__udp__batch_pending | 10 | |
influxdb_config__udp__batch_timeout | "1s" | |
influxdb_config__udp__read_buffer | 0 | |
influxdb_config__udp__udp_payload_size | 65536 | |
influxdb_config__continuous_queries__log_enabled | "true" | |
influxdb_config__continuous_queries__enabled | "true" | |
influxdb_config__continuous_queries__run_interval | "1s" |
依存関係
なし。
サンプルプレイブック
ロールの使用例を含めることは、ユーザーにとっても役に立ちます(例えば、パラメータとして渡された変数とともに):
- hosts: servers
roles:
- { role: juliendufresne.influxdb }
ライセンス
MIT / BSD
作成者情報
このロールは 2016年に Julien Dufresne により作成されました。