Commit 80d3dcf4 authored by Ross McDonald's avatar Ross McDonald
Browse files

Added more tests and extra variables/overrides for more granular configuration (if needed).

parent 5fa490e9
...@@ -7,7 +7,6 @@ Vagrant.configure(2) do |config| ...@@ -7,7 +7,6 @@ Vagrant.configure(2) do |config|
# config.vm.box = "relativkreativ/centos-7-minimal" # config.vm.box = "relativkreativ/centos-7-minimal"
# config.vm.box = "box-cutter/fedora22" # config.vm.box = "box-cutter/fedora22"
# config.vm.box = "puppetlabs/centos-6.6-64-nocm" # config.vm.box = "puppetlabs/centos-6.6-64-nocm"
# config.vm.box = "hansode/centos-6.5-x86_64"
BOX_COUNT = 1 BOX_COUNT = 1
(1..BOX_COUNT).each do |machine_id| (1..BOX_COUNT).each do |machine_id|
...@@ -27,6 +26,10 @@ Vagrant.configure(2) do |config| ...@@ -27,6 +26,10 @@ Vagrant.configure(2) do |config|
# ansible.verbose = 'vvvv' # ansible.verbose = 'vvvv'
ansible.limit = 'all' ansible.limit = 'all'
ansible.playbook = "test.yml" ansible.playbook = "test.yml"
# ansible.playbook = "playbooks/0.9.4.2_to_0.9.5.1_upgrade_path.yml"
# ansible.playbook = "playbooks/0.9.5.1_to_0.9.6_upgrade_path.yml"
# ansible.playbook = "playbooks/0.9.4.2_to_0.9.6_upgrade_path.yml"
# ansible.playbook = "playbooks/0.9.4.2_to_0.9.5.1_to_0.9.6_upgrade_path.yml"
ansible.sudo = true ansible.sudo = true
ansible.host_key_checking = false ansible.host_key_checking = false
ansible.extra_vars = { ansible.extra_vars = {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
when: influxdb_cluster_set.changed or influxdb_purge_peer_data when: influxdb_cluster_set.changed or influxdb_purge_peer_data
- name: Collect cluster status - name: Collect cluster status
command: influx -execute 'show servers' command: "{{ influxdb_binary_path }}/influx -execute 'show servers'"
register: influxdb_show_servers_output register: influxdb_show_servers_output
- name: Assert clustering status (local/vagrant) - name: Assert clustering status (local/vagrant)
......
--- ---
- name: Create InfluxDB-specific directories (if not already created)
file:
path: "{{ item }}"
state: directory
owner: influxdb
group: influxdb
mode: 0755
with_items:
- "{{ influxdb_configuration_dir }}"
- "{{ influxdb_meta_dir }}"
- "{{ influxdb_data_dir }}"
- "{{ influxdb_data_wal_dir }}"
- "{{ influxdb_hh_dir }}"
- name: Set templatized InfluxDB configuration - name: Set templatized InfluxDB configuration
template: template:
src: influxdb.conf.j2 src: influxdb.conf.j2
...@@ -23,12 +8,12 @@ ...@@ -23,12 +8,12 @@
owner: influxdb owner: influxdb
group: influxdb group: influxdb
mode: 0744 mode: 0744
notify: restart influxdb when: influxdb_template_configuration
- name: Start the InfluxDB service - name: Start the InfluxDB service
service: service:
name: influxdb name: influxdb
state: started state: restarted
enabled: yes enabled: yes
register: influxdb_started register: influxdb_started
when: influxdb_start_service when: influxdb_start_service
......
--- ---
- name: Check to see which databases already exist - name: Check to see which databases already exist
command: /opt/influxdb/influx -execute 'show databases' command: "{{ influxdb_binary_path }}/influx -execute 'show databases'"
register: db_listing register: db_listing
changed_when: no changed_when: no
- name: Create demo database - name: Create demo database
command: /opt/influxdb/influx -execute 'CREATE DATABASE {{ influxdb_sample_database_name }}' command: "{{ influxdb_binary_path }}/influx -execute 'CREATE DATABASE {{ influxdb_sample_database_name }}'"
when: db_listing.stdout.find("{{ influxdb_sample_database_name }}") == -1 when: db_listing.stdout.find("{{ influxdb_sample_database_name }}") == -1
- name: Load demo data - name: Load demo data
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
- name: Add InfluxDB repository [Debian/Ubuntu] - name: Add InfluxDB repository [Debian/Ubuntu]
apt_repository: apt_repository:
repo: deb https://repos.influxdata.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ influxdb_install_version }} repo: deb https://repos.influxdata.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ influxdb_install_version }}
state: present state: latest
when: influxdb_install_url is not defined or influxdb_install_url == None when: influxdb_install_url is not defined or influxdb_install_url == None
- name: Install InfluxDB packages [Debian/Ubuntu] - name: Install InfluxDB packages [Debian/Ubuntu]
......
...@@ -12,3 +12,6 @@ ...@@ -12,3 +12,6 @@
- include: demo.yml - include: demo.yml
tags: [influxdb, demo] tags: [influxdb, demo]
when: influxdb_load_sample_data and influxdb_http_auth_enabled == "false" and influxdb_start_service when: influxdb_load_sample_data and influxdb_http_auth_enabled == "false" and influxdb_start_service
- include: verify.yml
tags: [influxdb, verify]
---
- name: List databases for verification
command: "{{ influxdb_binary_path }}/influx -execute 'show databases'"
register: influxdb_show_databases
when: influxdb_verify_database_is_present is defined and influxdb_verify_database_is_present != None
- name: Fail if database is not present
fail: msg="Database {{ influxdb_verify_database_is_present }} not present!"
when: influxdb_verify_database_is_present is defined and influxdb_verify_database_is_present != None and influxdb_show_databases.stdout.find("{{ influxdb_verify_database_is_present }}") == -1
### Welcome to the InfluxDB configuration file. ### Welcome to the InfluxDB configuration file - generated by Ansible
# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com # Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
# The data includes raft id (random 8 bytes), os, arch, version, and metadata. # The data includes raft id (random 8 bytes), os, arch, version, and metadata.
......
...@@ -16,3 +16,13 @@ influxdb_purge_peer_data: no ...@@ -16,3 +16,13 @@ influxdb_purge_peer_data: no
# If yes, service will be started. Will not be started if set to no. # If yes, service will be started. Will not be started if set to no.
influxdb_start_service: yes influxdb_start_service: yes
# If yes, will overwrite the packaged configuration with an Asnible/jinja2 template
influxdb_template_configuration: yes
# If supplied, will check for presence of database, and error if not found (useful for upgrade
# testing).
influxdb_verify_database_is_present:
# Path for finding InfluxDB binaries. Added for backwards-compatibility with < 0.9.5
influxdb_binary_path: /usr/bin
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment