Support for influxdb 2+
This commit is contained in:
parent
1c88598a8d
commit
faf37c90a8
|
@ -1,16 +1,20 @@
|
||||||
---
|
---
|
||||||
influxdb_deb_repo: "deb https://repos.influxdata.com/ubuntu {{ ansible_distribution_release }} stable"
|
influxdb_deb_repo: "deb https://repos.influxdata.com/ubuntu {{ ansible_distribution_release }} stable"
|
||||||
influxdb_repo_key: 'https://repos.influxdata.com/influxdb.key'
|
influxdb_repo_key: 'https://repos.influxdata.com/influxdb.key'
|
||||||
|
influxdb_major_version: 2
|
||||||
influxdb_pkgs:
|
influxdb_pkgs:
|
||||||
- influxdb2
|
- influxdb2
|
||||||
- influxdb2-cli
|
- influxdb2-cli
|
||||||
|
|
||||||
influxdb_config_file: /etc/influxdb/influxdb.conf
|
influxdb_config_file: /etc/influxdb/influxdb.conf
|
||||||
|
influxdb_2_config_file: /etc/influxdb/config.toml
|
||||||
influxdb_config:
|
influxdb_config:
|
||||||
- {section: http, option: 'enabled', value: 'true', state: present}
|
- {section: http, option: 'enabled', value: 'true', state: present}
|
||||||
- {section: http, option: 'bind-address', value: '":8086"', state: present}
|
- {section: http, option: 'bind-address', value: '":8086"', state: present}
|
||||||
- {section: http, option: 'log-enabled', value: 'true', state: present}
|
- {section: http, option: 'log-enabled', value: 'true', state: present}
|
||||||
|
|
||||||
|
influxdb_2_config: []
|
||||||
|
|
||||||
influxdb_tls_letsencrypt_managed: true
|
influxdb_tls_letsencrypt_managed: true
|
||||||
influxdb_tls_enabled: false
|
influxdb_tls_enabled: false
|
||||||
influxdb_tls_cert_dir: /etc/pki/influxdb
|
influxdb_tls_cert_dir: /etc/pki/influxdb
|
||||||
|
@ -20,3 +24,7 @@ influxdb_tls_config:
|
||||||
- {section: http, option: 'https-enabled', value: '{{ influxdb_tls_enabled | lower }}', state: present}
|
- {section: http, option: 'https-enabled', value: '{{ influxdb_tls_enabled | lower }}', state: present}
|
||||||
- {section: http, option: 'https-certificate', value: '"{{ influxdb_tls_cert_path }}"', state: present}
|
- {section: http, option: 'https-certificate', value: '"{{ influxdb_tls_cert_path }}"', state: present}
|
||||||
- {section: http, option: 'https-private-key', value: '"{{ influxdb_tls_key_path }}"', state: present}
|
- {section: http, option: 'https-private-key', value: '"{{ influxdb_tls_key_path }}"', state: present}
|
||||||
|
|
||||||
|
influxdb_2_tls_config:
|
||||||
|
- {option: 'tls-cert', value: '"{{ influxdb_tls_cert_path }}"', state: present}
|
||||||
|
- {option: 'tls-key', value: '"{{ influxdb_tls_key_path }}"', state: present}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
- name: Manage the Influxd configuration
|
- name: Manage the Influxd configuration
|
||||||
block:
|
block:
|
||||||
- name: Influxdb configuration {{ influxdb_config_file }}
|
- name: Influxdb 1.x configuration {{ influxdb_config_file }}
|
||||||
ini_file:
|
ini_file:
|
||||||
path: '{{ influxdb_config_file }}'
|
path: '{{ influxdb_config_file }}'
|
||||||
section: '{{ item.section }}'
|
section: '{{ item.section }}'
|
||||||
|
@ -35,6 +35,21 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: '{{ influxdb_config }}'
|
loop: '{{ influxdb_config }}'
|
||||||
notify: restart influxdb
|
notify: restart influxdb
|
||||||
|
when: influxdb_major_version < 2
|
||||||
|
|
||||||
|
- name: Influxdb 2+ configuration {{ influxdb_2_config_file }}
|
||||||
|
lineinfile:
|
||||||
|
path: '{{ influxdb_2_config_file }}'
|
||||||
|
regexp: '^{{ item.option }}\s'
|
||||||
|
line: '{{ item.option }} = "{{ item.value }}"'
|
||||||
|
state: "{{ item.state | default('present') }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
create: true
|
||||||
|
loop: '{{ influxdb_2_config }}'
|
||||||
|
notify: restart influxdb
|
||||||
|
when: influxdb_major_version < 2
|
||||||
|
|
||||||
tags: ['influxdb', 'influxdb_config']
|
tags: ['influxdb', 'influxdb_config']
|
||||||
|
|
||||||
|
@ -65,7 +80,7 @@
|
||||||
remote_src: true
|
remote_src: true
|
||||||
notify: restart influxdb
|
notify: restart influxdb
|
||||||
|
|
||||||
- name: Influxdb configuration {{ influxdb_config_file }}
|
- name: Influxdb 1.x configuration for TLS {{ influxdb_config_file }}
|
||||||
ini_file:
|
ini_file:
|
||||||
path: '{{ influxdb_config_file }}'
|
path: '{{ influxdb_config_file }}'
|
||||||
section: '{{ item.section }}'
|
section: '{{ item.section }}'
|
||||||
|
@ -77,6 +92,21 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
loop: '{{ influxdb_tls_config }}'
|
loop: '{{ influxdb_tls_config }}'
|
||||||
notify: restart influxdb
|
notify: restart influxdb
|
||||||
|
when: influxdb_major_version < 2
|
||||||
|
|
||||||
|
- name: Influxdb 2+ configuration for TLS {{ influxdb_2_config_file }}
|
||||||
|
lineinfile:
|
||||||
|
path: '{{ influxdb_2_config_file }}'
|
||||||
|
regexp: '^{{ item.option }}\s'
|
||||||
|
line: '{{ item.option }} = "{{ item.value }}"'
|
||||||
|
state: "{{ item.state | default('present') }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
create: true
|
||||||
|
loop: '{{ influxdb_2_tls_config }}'
|
||||||
|
notify: restart influxdb
|
||||||
|
when: influxdb_major_version < 2
|
||||||
|
|
||||||
- name: Install a script that fixes the letsencrypt certificate for influxdb and then restarts the service
|
- name: Install a script that fixes the letsencrypt certificate for influxdb and then restarts the service
|
||||||
template:
|
template:
|
||||||
|
|
Loading…
Reference in New Issue