├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── ansible.cfg ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── tasks └── main.yml ├── templates ├── influxdb-data.conf.j2 └── influxdb-meta.conf.j2 ├── tests ├── test-meta-data-node.yml ├── three-node-meta-cluster.yml └── vagrant.yml └── vars └── main.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | *.retry 3 | *.deb 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 InfluxData 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # InfluxDB Enterprise 2 | 3 | This role will install an InfluxDB Enterprise cluster. Both meta and data nodes. 4 | 5 | ## Usage 6 | 7 | Add the following to your `requirements.yml`: 8 | 9 | ``` 10 | - src: influxdata.influxdb-enterprise 11 | name: influxdb-enterprise 12 | ``` 13 | 14 | Install to your roles directory: 15 | 16 | ` $ ansible-galaxy install -r requirements.yaml` 17 | 18 | Include in your Playbooks (see [this example](https://github.com/influxdata/ansible-influxdb-enterprise/blob/master/tests/vagrant.yml) for a more detailed usage): 19 | 20 | ``` 21 | --- 22 | # site.yml 23 | 24 | - hosts: influxdb 25 | become: yes 26 | 27 | roles: 28 | - { role: 'influxdb-enterprise', influx_node_type: meta } 29 | - { role: 'influxdb-enterprise', influx_node_type: data } 30 | 31 | vars: 32 | influx_cluster_auto_join: true 33 | influx_meta_cluster_leader: influxdb_001 34 | influx_enterprise_license_key: XXX-XXX-XXX 35 | influx_queries: 36 | - "CREATE DATABASE test" 37 | - "CREATE RETENTION POLICY testrp ON test DURATION 24h REPLICATION 2 default" 38 | - "ALTER RETENTION POLICY autogen ON test DURATION 666h REPLICATION 2 default" 39 | ``` 40 | 41 | _Note: When bringing up the cluster for the first time, it's a good idea to use `--skip-tags=influxdb-cluster`, this ensures all hosts are up before establishing a cluster. It's also wise to run against the first meta-node first using the `--limit` option. We'll improve this in the future._ 42 | 43 | # Prerequisites 44 | 45 | * InfluxDB Enterprise License Key, a free trial can be obtained [here](https://www.influxdata.com/products/) 46 | * Ansible, see [getting started](https://www.ansible.com/get-started) for more information. 47 | * Vagrant (for testing and evaluation only) 48 | 49 | # Contributing 50 | 51 | Pull requests welcome! 52 | 53 | A full test suite can be executed using via the following commands. 54 | 55 | ``` 56 | $ export INFLUX_ENTERPRISE_LICENSE_KEY=XXX-XXX-XXX 57 | $ vagrant up 58 | $ ansible-playbook tests/cluster.yml -vvvv 59 | ``` 60 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = ENV["VAGRANT_VM_BOX"] || "ubuntu/trusty64" 6 | 7 | BOX_COUNT = ENV["VAGRANT_BOX_COUNT"] ? ENV["VAGRANT_BOX_COUNT"].to_i : 1 8 | MEMORY = ENV["VAGRANT_MEMORY"] || 256 9 | CPUS = ENV["VAGRANT_CPUS"] || 1 10 | META_BIND_PORT = 8091 11 | DATA_BIND_PORT = 8086 12 | 13 | leader = "" 14 | members = Array.new 15 | 16 | (1..BOX_COUNT).each do |machine_id| 17 | primary = machine_id == 1 ? true : false 18 | host_postfix = "%03d" % machine_id 19 | hostname = "testnode-#{host_postfix}" 20 | leader = hostname if machine_id == 1 21 | 22 | members << hostname 23 | 24 | config.vm.define hostname, primary: primary do |machine| 25 | machine.vm.hostname = hostname 26 | machine.vm.network "private_network", type: "dhcp" 27 | machine.vm.network "forwarded_port", guest: DATA_BIND_PORT, host: DATA_BIND_PORT if primary 28 | machine.vm.network "forwarded_port", guest: META_BIND_PORT, host: META_BIND_PORT if primary 29 | machine.vm.provider "virtualbox" do |v| 30 | v.memory = MEMORY 31 | v.cpus = CPUS 32 | end 33 | 34 | machine.vm.provision "ansible" do |ansible| 35 | ansible.verbose = 'vv' 36 | ansible.limit = 'all' 37 | ansible.playbook = "tests/vagrant.yml" 38 | ansible.sudo = true 39 | ansible.raw_arguments = ENV["ANSIBLE_RAW_ARGS"] || nil 40 | ansible.host_key_checking = false 41 | ansible.groups = {"influx-nodes" => members} 42 | 43 | ansible.extra_vars = { 44 | influx_enterprise_license_key: ENV['INFLUX_ENTERPRISE_LICENSE_KEY'], 45 | influx_meta_cluster_leader: leader, 46 | } 47 | end if machine_id == BOX_COUNT # Run Ansible, only once the final machine is configured 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | roles_path = ./.. 3 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Role Settings 3 | influx_node_types: ["meta", "data"] 4 | influx_node_type: "meta" # By default, install node as a meta-node 5 | influx_pkg_base_url: "https://dl.influxdata.com/enterprise/releases" 6 | influx_version: "1.3.7-c1.3.7" # The version of the package to install 7 | influx_configuration_dir: "/etc/influxdb" # The base directory of the config 8 | influx_manage_config: true # Build and install config from templates 9 | influx_cluster_auto_join: true # Attempt to add members to the cluster automatically 10 | influx_meta_cluster_leader: # The IP of the meta-node cluster leader 11 | influx_users: [] 12 | influx_queries: [] 13 | 14 | # Enterprise settings 15 | influx_enterprise_license_key: 16 | # The contents of a provided license file. 17 | influx_enterprise_license: "" 18 | # Where the file will be installed on the remote host. 19 | influx_enterprise_license_path: "" 20 | 21 | # influxdb-meta.conf.j2 template options 22 | influx_meta_reporting_disabled: false 23 | influx_meta_bind_address: 24 | influx_meta_bind_port: 8089 25 | influx_meta_registration_enabled: false 26 | influx_meta_registration_server_url: 27 | influx_meta_dir: /var/lib/influxdb/meta 28 | influx_meta_http_bind_address: 29 | influx_meta_http_bind_port: 8091 30 | influx_meta_https_enabled: false 31 | influx_meta_https_certificate: 32 | influx_meta_gossip_frequency: 5s 33 | influx_meta_announcement_expiration: 30s 34 | influx_meta_retention_autocreate: true 35 | influx_meta_election_timeout: 1s 36 | influx_meta_heartbeat_timeout: 1s 37 | influx_meta_leader_lease_timeout: 500ms 38 | influx_meta_commit_timeout: 50ms 39 | influx_meta_cluster_tracing: false 40 | influx_meta_raft_promotion_enabled: true 41 | influx_meta_logging_enabled: true 42 | influx_meta_pprof_enabled: false 43 | influx_meta_lease_duration: 1m0s 44 | 45 | # influxdb-data.conf.j2 parameters 46 | influx_data_bind_address: 47 | influx_data_bind_port: 8088 48 | influx_data_configuration_dir: /etc/influxdb 49 | influx_data_disable_reporting: false 50 | influx_data_meta_tls_enabled: false 51 | influx_data_registration_enabled: false 52 | influx_data_registration_server_url: 53 | influx_data_enabled: true 54 | influx_data_dir: /var/lib/influxdb/data 55 | influx_data_max_wal_size: 104857600 56 | influx_data_wal_flush_interval: 10m0s 57 | influx_data_wal_partition_flush_delay: 2s 58 | influx_data_wal_dir: /var/lib/influxdb/wal 59 | influx_data_wal_logging_enabled: true 60 | influx_data_wal_ready_series_size: 30720 61 | influx_data_wal_compaction_threshold: 0.5 62 | influx_data_wal_max_series_size: 1048576 63 | influx_data_wal_flush_cold_interval: 5s 64 | influx_data_wal_partition_size_threshold: 52428800 65 | influx_data_query_log_enabled: true 66 | influx_data_cache_max_memory_size: 524288000 67 | influx_data_cache_snapshot_memory_size: 26214400 68 | influx_data_cache_snapshot_write_cold_duration: 1h0m0s 69 | influx_data_compact_full_write_cold_duration: 24h0m0s 70 | influx_data_max_points_per_block: 0 71 | influx_data_data_logging_enabled: true 72 | influx_data_force_remote_mapping: false 73 | influx_data_write_timeout: 5s 74 | influx_data_shard_writer_timeout: 5s 75 | influx_data_max_remote_write_connections: 3 76 | influx_data_shard_mapper_timeout: 5s 77 | influx_data_retention_enabled: true 78 | influx_data_retention_check_interval: 30m0s 79 | influx_data_shard_precreation_enabled: true 80 | influx_data_shard_precreation_check_interval: 10m0s 81 | influx_data_shard_precreation_advance_period: 30m0s 82 | influx_data_admin_enabled: false 83 | influx_data_admin_username: 84 | influx_data_admin_password: 85 | influx_data_admin_bind_address: :8083 86 | influx_data_admin_https_enabled: false 87 | influx_data_admin_https_certificate: /etc/ssl/influxdb.pem 88 | influx_data_monitor_store_enabled: true 89 | influx_data_monitor_store_database: _internal 90 | influx_data_monitor_store_interval: 10s 91 | influx_data_http_enabled: true 92 | influx_data_http_bind_address: 93 | influx_data_http_bind_port: 8086 94 | influx_data_http_auth_enabled: false 95 | influx_data_http_log_enabled: true 96 | influx_data_http_write_tracing: false 97 | influx_data_http_pprof_enabled: false 98 | influx_data_http_https_enabled: false 99 | influx_data_http_https_certificate: /etc/ssl/influxdb.pem 100 | influx_data_cq_log_enabled: true 101 | influx_data_cq_enabled: true 102 | influx_data_cq_run_interval: 1s 103 | influx_data_hh_enabled: true 104 | influx_data_hh_dir: /var/lib/influxdb/hh 105 | influx_data_hh_max_size: 1073741824 106 | influx_data_hh_max_age: 168h0m0s 107 | influx_data_hh_retry_rate_limit: 0 108 | influx_data_hh_retry_interval: 1s 109 | influx_data_hh_retry_max_interval: 1m0s 110 | influx_data_hh_purge_interval: 1h0m0s 111 | influx_data_subscriber_enabled: true 112 | influx_data_max_series_per_database: 1000000 113 | influx_data_max_values_per_tag: 100000 114 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: 'restart influxdb-meta' 3 | service: 4 | name: "{{ influx_svc_names['meta'] }}" 5 | state: 'restarted' 6 | 7 | - name: 'restart influxdb-data' 8 | service: 9 | name: "{{ influx_svc_names['data'] }}" 10 | state: 'restarted' 11 | 12 | - name: 'pause' 13 | pause: 14 | seconds: 3 15 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: 'InfluxData' 4 | description: 'Install and configure InfluxDB Enterprise, a time-series database' 5 | company: 'InfluxData' 6 | license: 'MIT' 7 | min_ansible_version: 2.2 8 | platforms: 9 | - name: 'EL' 10 | versions: 11 | - 6 12 | - 7 13 | - name: 'Ubuntu' 14 | versions: 15 | - 'trusty' 16 | - 'utopic' 17 | - 'vivid' 18 | - name: 'Debian' 19 | versions: 20 | - 'stretch' 21 | - 'jessie' 22 | - 'wheezy' 23 | categories: 24 | - "clustering" 25 | - "database:nosql" 26 | - "database:time_series" 27 | - "influxdata" 28 | - "influxdb" 29 | - "enterprise" 30 | dependencies: [] 31 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: "Check for valid node type" 3 | fail: 4 | msg: "Invalid node type configured, can only be 'meta' or 'data'" 5 | when: influx_node_type not in influx_node_types 6 | tags: 'influxdb' 7 | 8 | - name: "{{ influx_node_type }} : {{ ansible_os_family }} : Install packages" 9 | apt: 10 | deb: "{{ influx_pkg_base_url }}/influxdb-{{ influx_node_type }}_{{ influx_version}}_amd64.deb" 11 | state: 'present' 12 | when: ansible_os_family == 'Debian' 13 | tags: ['influxdb', 'influxdb-install', "{{ influx_node_type }}"] 14 | 15 | - name: "{{influx_node_type}} : {{ ansible_os_family }} : Install packages" 16 | yum: 17 | name: "{{ influx_pkg_base_url }}/influxdb-{{ influx_node_type }}-{{ influx_version}}.x86_64.rpm" 18 | state: 'present' 19 | when: ansible_os_family == 'RedHat' 20 | tags: ['influxdb', 'influxdb-install', "{{ influx_node_type }}"] 21 | 22 | - name: "{{ influx_node_type }} : Create configuration directory path" 23 | file: 24 | path: "{{ influx_configuration_dir }}" 25 | state: 'directory' 26 | when: influx_manage_config 27 | tags: ['influxdb', 'influxdb-config', "{{ influx_node_type }}"] 28 | 29 | - name: "{{ influx_node_type }} : Build and install configuration file" 30 | template: 31 | src: "influxdb-{{ influx_node_type }}.conf.j2" 32 | dest: "{{ influx_configuration_dir }}/{{ influx_config_filenames[influx_node_type] }}" 33 | force: 'yes' 34 | backup: 'yes' 35 | owner: 'influxdb' 36 | group: 'influxdb' 37 | mode: 0744 38 | notify: "restart influxdb-{{ influx_node_type }}" 39 | when: influx_manage_config 40 | tags: ['influxdb', 'influxdb-config', "{{ influx_node_type }}"] 41 | 42 | - name: "{{ influx_node_type }} : Build and install license file" 43 | copy: 44 | dest: "{{ influx_enterprise_license_path }}" 45 | content: "{{ influx_enterprise_license}}" 46 | force: 'yes' 47 | backup: 'yes' 48 | owner: 'influxdb' 49 | group: 'influxdb' 50 | mode: 0744 51 | notify: "restart influxdb-{{ influx_node_type }}" 52 | when: influx_enterprise_license != "" 53 | tags: ['influxdb', 'influxdb-config', "{{ influx_node_type }}"] 54 | 55 | - name: "{{ influx_node_type }} : Start and enable the service" 56 | service: 57 | name: "{{ influx_svc_names[influx_node_type] }}" 58 | state: 'started' 59 | enabled: 'yes' 60 | tags: ['influxdb', 'influxdb-service', "{{ influx_node_type }}"] 61 | 62 | 63 | - name: "{{ influx_node_type }} : Get list of nodes in the cluster" 64 | # TODO: Support for admin user authentication 65 | uri: 66 | body_format: 'json' 67 | url: "{{ influx_meta_https_enabled | ternary('https', 'http') }}://0.0.0.0:{{ influx_meta_http_bind_port}}/show-cluster" 68 | user: "{{ influx_data_admin_username | default(omit) }}" 69 | password: "{{ influx_data_admin_password | default(omit) }}" 70 | delegate_to: "{{ influx_meta_cluster_leader }}" 71 | when: 72 | - influx_cluster_auto_join 73 | - influx_meta_cluster_leader is defined 74 | register: influx_cluster_state 75 | changed_when: false 76 | tags: ['influxdb', 'influxdb-cluster', "{{ influx_node_type }}"] 77 | 78 | - name: "{{ influx_node_type }} : Add node to cluster" 79 | command: "influxd-ctl add-{{ influx_node_type }} {{ ansible_hostname }}:{{ (influx_node_type == 'meta') | ternary(influx_meta_http_bind_port, influx_data_bind_port) }}" 80 | delegate_to: "{{ influx_meta_cluster_leader }}" 81 | when: 82 | - influx_cluster_auto_join 83 | - influx_meta_cluster_leader is defined 84 | - ansible_hostname not in influx_cluster_state.json[influx_node_type]|map(attribute='tcpAddr')|join 85 | tags: ['influxdb', 'influxdb-cluster', "{{ influx_node_type }}"] 86 | 87 | - name: "{{ influx_node_type }}: Creating users and assigning privileges" 88 | uri: 89 | url: 'http://localhost:8091/user' 90 | method: 'POST' 91 | body: 92 | action: "create" 93 | user: 94 | name: "{{ item.username }}" 95 | password: "{{ item.password }}" 96 | permissions: "{{ item.permissions }}" 97 | status_code: 200 98 | body_format: 'json' 99 | follow_redirects: 'all' 100 | with_items: "{{ influx_users }}" 101 | tags: ['influxdb', 'infuxdb-users', 'influxdb-perms', "{{ influx_node_type }}"] 102 | run_once: true 103 | ignore_errors: true 104 | changed_when: false 105 | no_log: true 106 | 107 | - name: "{{ influx_node_type }}: Running queries" 108 | uri: 109 | url: "http://localhost:8086/query?q={{ item | urlencode }}" 110 | method: 'POST' 111 | user: "{{ influx_data_admin_username | default(omit) }}" 112 | password: "{{ influx_data_admin_password | default(omit) }}" 113 | status_code: 200 114 | with_items: "{{ influx_queries }}" 115 | tags: ['influxdb', 'influxdb-cluster', "{{ influx_node_type }}"] 116 | changed_when: false 117 | when: influx_node_type == 'data' 118 | -------------------------------------------------------------------------------- /templates/influxdb-data.conf.j2: -------------------------------------------------------------------------------- 1 | ### Welcome to the InfluxDB Enterprise configuration file (generated by Ansible). 2 | 3 | # Once every 24 hours InfluxDB Enterprise will report anonymous data to m.influxdb.com 4 | # The data includes raft id (random 8 bytes), os, arch, version, and metadata. 5 | # We don't track ip addresses of servers reporting. This is only used 6 | # to track the number of instances running and the versions, which 7 | # is very helpful for us. 8 | 9 | # Change this option to true to disable reporting. 10 | reporting-disabled = {{ influx_data_disable_reporting|lower|mandatory }} 11 | hostname = "{{ ansible_hostname|mandatory }}" 12 | meta-tls-enabled = {{ influx_data_meta_tls_enabled|lower|mandatory }} 13 | bind-address = "{{ influx_data_bind_address }}:{{ influx_data_bind_port|mandatory }}" 14 | 15 | [enterprise] 16 | registration-enabled = {{ influx_data_registration_enabled|lower|mandatory }} 17 | registration-server-url = "{{ influx_data_registration_server_url|default("", true) }}" 18 | license-key = "{{ influx_enterprise_license_key|default("", true) }}" 19 | license-path = "{{ influx_data_license_path|default("", true) }}" 20 | 21 | # The meta section can be disregarded 22 | [meta] 23 | dir = "/var/lib/influxdb/meta" 24 | 25 | [data] 26 | enabled = {{ influx_data_enabled|lower|mandatory }} 27 | dir = "{{ influx_data_dir|mandatory }}" 28 | max-wal-size = {{ influx_data_max_wal_size|mandatory }} 29 | wal-flush-interval = "{{ influx_data_wal_flush_interval|mandatory }}" 30 | wal-partition-flush-delay = "{{ influx_data_wal_partition_flush_delay|mandatory }}" 31 | wal-dir = "{{ influx_data_wal_dir|mandatory }}" 32 | wal-logging-enabled = {{ influx_data_wal_logging_enabled|lower|mandatory }} 33 | wal-ready-series-size = {{ influx_data_wal_ready_series_size|mandatory }} 34 | wal-compaction-threshold = {{ influx_data_wal_compaction_threshold|mandatory }} 35 | wal-max-series-size = {{ influx_data_wal_max_series_size|mandatory }} 36 | wal-flush-cold-interval = "{{ influx_data_wal_flush_cold_interval|mandatory }}" 37 | wal-partition-size-threshold = {{ influx_data_wal_partition_size_threshold|mandatory }} 38 | query-log-enabled = {{ influx_data_query_log_enabled|lower|mandatory }} 39 | cache-max-memory-size = {{ influx_data_cache_max_memory_size|mandatory }} 40 | cache-snapshot-memory-size = {{ influx_data_cache_snapshot_memory_size|mandatory }} 41 | cache-snapshot-write-cold-duration = "{{ influx_data_cache_snapshot_write_cold_duration|mandatory }}" 42 | compact-full-write-cold-duration = "{{ influx_data_compact_full_write_cold_duration|mandatory }}" 43 | max-points-per-block = {{ influx_data_max_points_per_block|mandatory }} 44 | data-logging-enabled = {{ influx_data_data_logging_enabled|lower|mandatory }} 45 | max-series-per-database = {{ influx_data_max_series_per_database }} 46 | max-values-per-tag = {{ influx_data_max_values_per_tag }} 47 | 48 | [cluster] 49 | force-remote-mapping = {{ influx_data_force_remote_mapping|lower|mandatory }} 50 | write-timeout = "{{ influx_data_write_timeout|mandatory }}" 51 | shard-writer-timeout = "{{ influx_data_shard_writer_timeout|mandatory }}" 52 | max-remote-write-connections = {{ influx_data_max_remote_write_connections|mandatory }} 53 | shard-mapper-timeout = "{{ influx_data_shard_mapper_timeout|mandatory }}" 54 | 55 | [retention] 56 | enabled = {{ influx_data_retention_enabled|lower|mandatory }} 57 | check-interval = "{{ influx_data_retention_check_interval|mandatory }}" 58 | 59 | [shard-precreation] 60 | enabled = {{ influx_data_shard_precreation_enabled|lower|mandatory }} 61 | check-interval = "{{ influx_data_shard_precreation_check_interval|mandatory }}" 62 | advance-period = "{{ influx_data_shard_precreation_advance_period|mandatory }}" 63 | 64 | [admin] 65 | enabled = {{ influx_data_admin_enabled|lower|mandatory }} 66 | bind-address = "{{ influx_data_admin_bind_address|mandatory }}" 67 | https-enabled = {{ influx_data_admin_https_enabled|lower|mandatory }} 68 | https-certificate = "{{ influx_data_admin_https_certificate|mandatory }}" 69 | 70 | [monitor] 71 | store-enabled = {{ influx_data_monitor_store_enabled|lower|mandatory }} 72 | store-database = "{{ influx_data_monitor_store_database|mandatory }}" 73 | store-interval = "{{ influx_data_monitor_store_interval|mandatory }}" 74 | 75 | [subscriber] 76 | enabled = {{ influx_data_subscriber_enabled|lower|mandatory }} 77 | 78 | [http] 79 | enabled = {{ influx_data_http_enabled|lower|mandatory }} 80 | bind-address = "{{ influx_data_http_bind_address_hostname|default("", true) }}:{{ influx_data_http_bind_port|mandatory }}" 81 | auth-enabled = {{ influx_data_http_auth_enabled|lower|mandatory }} 82 | log-enabled = {{ influx_data_http_log_enabled|lower|mandatory }} 83 | write-tracing = {{ influx_data_http_write_tracing|lower|mandatory }} 84 | pprof-enabled = {{ influx_data_http_pprof_enabled|lower|mandatory }} 85 | https-enabled = {{ influx_data_http_https_enabled|lower|mandatory }} 86 | https-certificate = "{{ influx_data_http_https_certificate|mandatory }}" 87 | 88 | [continuous_queries] 89 | log-enabled = {{ influx_data_cq_log_enabled|lower|mandatory }} 90 | enabled = {{ influx_data_cq_enabled|lower|mandatory }} 91 | run-interval = "{{ influx_data_cq_run_interval|mandatory }}" 92 | 93 | [hinted-handoff] 94 | enabled = {{ influx_data_hh_enabled|lower|mandatory }} 95 | dir = "{{ influx_data_hh_dir|mandatory }}" 96 | max-size = {{ influx_data_hh_max_size|mandatory }} 97 | max-age = "{{ influx_data_hh_max_age|mandatory }}" 98 | retry-rate-limit = {{ influx_data_hh_retry_rate_limit|mandatory }} 99 | retry-interval = "{{ influx_data_hh_retry_interval|mandatory }}" 100 | retry-max-interval = "{{ influx_data_hh_retry_max_interval|mandatory }}" 101 | purge-interval = "{{ influx_data_hh_purge_interval|mandatory }}" 102 | -------------------------------------------------------------------------------- /templates/influxdb-meta.conf.j2: -------------------------------------------------------------------------------- 1 | hostname = "{{ ansible_hostname|mandatory }}" 2 | 3 | [enterprise] 4 | registration-enabled = {{ influx_meta_registration_enabled|lower|mandatory }} 5 | registration-server-url = "{{ influx_meta_registration_server_url|default("", true) }}" 6 | license-key = "{{ influx_enterprise_license_key|default("", true) }}" 7 | license-path = "{{ influx_meta_license_path|default("", true) }}" 8 | 9 | [meta] 10 | dir = "{{ influx_meta_dir|mandatory }}" 11 | bind-address = "{{ influx_meta_bind_address_hostname|default("", true) }}:{{ influx_meta_bind_port|mandatory }}" 12 | http-bind-address = "{{ influx_meta_http_bind_address_hostname|default("", true) }}:{{ influx_meta_http_bind_port|mandatory }}" 13 | https-enabled = {{ influx_meta_https_enabled|lower|mandatory }} 14 | https-certificate = "{{ influx_meta_https_certificate|mandatory }}" 15 | gossip-frequency = "{{ influx_meta_gossip_frequency|mandatory }}" 16 | announcement-expiration = "{{ influx_meta_announcement_expiration|mandatory }}" 17 | retention-autocreate = {{ influx_meta_retention_autocreate|lower|mandatory }} 18 | election-timeout = "{{ influx_meta_election_timeout|mandatory }}" 19 | heartbeat-timeout = "{{ influx_meta_heartbeat_timeout|mandatory }}" 20 | leader-lease-timeout = "{{ influx_meta_leader_lease_timeout|mandatory }}" 21 | commit-timeout = "{{ influx_meta_commit_timeout|mandatory }}" 22 | cluster-tracing = {{ influx_meta_cluster_tracing|lower|mandatory }} 23 | raft-promotion-enabled = {{ influx_meta_raft_promotion_enabled|lower|mandatory }} 24 | logging-enabled = {{ influx_meta_logging_enabled|lower|mandatory }} 25 | pprof-enabled = {{ influx_meta_pprof_enabled|lower|mandatory }} 26 | lease-duration = "{{ influx_meta_lease_duration|mandatory }}" 27 | -------------------------------------------------------------------------------- /tests/test-meta-data-node.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # These tests need to be run against a cluster with at least 3 meta-nodes in the cluster 3 | - hosts: localhost 4 | tasks: 5 | - name: Test data node is up and OK 6 | uri: 7 | url: http://localhost:8086/status 8 | status_code: 204 9 | return_content: yes 10 | register: body 11 | 12 | - name: Test ping resrouce 13 | uri: 14 | url: http://localhost:8091/status 15 | status_code: 200 16 | return_content: yes 17 | register: body 18 | 19 | - name: Test the meta node is running 20 | fail: 21 | when: body.json.nodeType != 'meta' 22 | -------------------------------------------------------------------------------- /tests/three-node-meta-cluster.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # These tests need to be run against a cluster with at least 3 meta-nodes in the cluster 3 | - hosts: localhost 4 | tasks: 5 | - name: Test erroneous endpoint 6 | uri: 7 | url: http://localhost:8091/ding 8 | status_code: 400 9 | return_content: yes 10 | register: body 11 | 12 | - name: Test erroneous response body 13 | fail: 14 | when: "'error parsing index' not in body.content" 15 | 16 | - name: Test ping resrouce 17 | uri: 18 | url: http://localhost:8091/ping 19 | status_code: 200 20 | return_content: yes 21 | register: body 22 | 23 | - name: Test ping response 24 | fail: 25 | when: '"metanode-00" not in body.json.addr' 26 | 27 | - name: Test ping resrouce 28 | uri: 29 | url: http://localhost:8091/status 30 | status_code: 200 31 | return_content: yes 32 | register: body 33 | 34 | - name: Test there are 3 peers in the cluster 35 | fail: 36 | when: body.json.peers|length|int < 3 37 | -------------------------------------------------------------------------------- /tests/vagrant.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | pre_tasks: 4 | - name: "Check a license key has been set" 5 | fail: 6 | msg: "License key has not been set, see Vagrantfile" 7 | when: influx_enterprise_license_key is not defined 8 | - name: "Populate hosts file" 9 | lineinfile: 10 | dest: '/etc/hosts' 11 | regexp: '.*{{ item }}$' 12 | line: "{{ hostvars[item].facter_ipaddress_eth1 }} {{item}}" 13 | state: 'present' 14 | with_items: "{{ groups['influx-nodes'] }}" 15 | roles: 16 | - { role: 'ansible-influxdb-enterprise' } 17 | - { role: 'ansible-influxdb-enterprise', influx_node_type: 'data' } 18 | vars: 19 | influx_users: 20 | - { 21 | username: "testadmin", 22 | password: "asdf1234", 23 | permissions: {"": ["ViewAdmin", "ViewChronograf", "CreateDatabase", "CreateUserAndRole", "DropDatabase", "DropData", "ReadData", "WriteData", "ManageShard", "ManageContinuousQuery", "ManageQuery", "ManageSubscription", "Monitor"] } 24 | } 25 | 26 | influx_queries: 27 | - "CREATE DATABASE test" 28 | - "CREATE RETENTION POLICY test ON test DURATION 24h REPLICATION 2 default" 29 | - "ALTER RETENTION POLICY autogen ON test DURATION 666h REPLICATION 2" 30 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | # These vars have the highest precedence, should rarely be changed. 2 | influx_svc_names: { 'data': 'influxdb', 'meta': 'influxdb-meta' } 3 | influx_config_filenames: { 'data': 'influxdb.conf', 'meta': 'influxdb-meta.conf' } 4 | influx_license_filenames: { 'data': 'license.json', 'meta': 'license-meta.json' } 5 | --------------------------------------------------------------------------------