aboutsummaryrefslogtreecommitdiff
path: root/roles/influxdb/tasks
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-07 01:54:25 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-07 01:54:25 +0200
commit2ccf20e70715acd02f86415a61341476ef2c2f14 (patch)
tree9dbf4ecc9a054f1588cea2e0557ef02b49ab5ac4 /roles/influxdb/tasks
parent4000e16e20ae47423542db221b9ab636cf3d79b9 (diff)
downloadansible_collection-2ccf20e70715acd02f86415a61341476ef2c2f14.tar.gz
add influxdb
Diffstat (limited to 'roles/influxdb/tasks')
-rw-r--r--roles/influxdb/tasks/main.yml74
1 files changed, 74 insertions, 0 deletions
diff --git a/roles/influxdb/tasks/main.yml b/roles/influxdb/tasks/main.yml
new file mode 100644
index 0000000..0ccda4c
--- /dev/null
+++ b/roles/influxdb/tasks/main.yml
@@ -0,0 +1,74 @@
+---
+- name: Install GnuPG
+ apt:
+ update_cache: yes
+ name:
+ - gnupg2
+ become: yes
+
+- name: APT Key
+ apt_key:
+ url: 'https://repos.influxdata.com/influxdb.key'
+ state: present
+ become: yes
+
+- name: Install repos
+ template:
+ src: influxdb.list.j2
+ dest: /etc/apt/sources.list.d/influxdb.list
+ become: yes
+
+- name: Install Packages
+ apt:
+ update_cache: yes
+ name:
+ - curl
+ - python3-influxdb
+ - influxdb
+ become: yes
+
+- name: InfluxDB user setup
+ user:
+ name: influxdb
+ groups:
+ - ssl-cert
+ append: yes
+ become: yes
+
+- name: Install configuration
+ template:
+ src: influxdb.conf.j2
+ dest: /etc/influxdb/influxdb.conf
+ become: yes
+ notify: Restart influxdb
+
+- name: Check for changed cert
+ command: /bin/true
+ when:
+ - cert_changed
+ notify:
+ - Restart influxdb
+
+- name: create Influx DBs
+ influxdb_database:
+ database_name: '{{ item }}'
+ hostname: localhost
+ port: 8086
+ ssl: yes
+ validate_certs: no
+ state: present
+ with_items: '{{ influx_dbs }}'
+ become: yes
+
+- name: create Influx Users
+ influxdb_user:
+ user_name: '{{ item.key }}'
+ user_password: '{{ item.value.password }}'
+ grants: '{{ item.value.grants }}'
+ hostname: localhost
+ port: 8086
+ ssl: yes
+ validate_certs: no
+ state: present
+ with_dict: '{{ influx_users }}'
+ become: yes