influxdb: First version of role

This commit is contained in:
Timo Makinen 2022-07-12 14:07:41 +00:00
parent 54ce042c58
commit b05e702219
4 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,6 @@
INFLUXDB_META_DIR="/srv/influxdb/meta"
INFLUXDB_DATA_DIR="/srv/influxdb/data"
INFLUXDB_DATA_WAL_DIR="/srv/influxdb/wal"
INFLUXDB_HTTP_BIND_ADDRESS="127.0.0.1:8086"
INFLUXDB_HTTP_AUTH_ENABLED=true

View file

@ -0,0 +1,5 @@
---
- name: restart influxdb
ansible.builtin.service:
name: influxdb
state: restarted

View file

@ -0,0 +1,3 @@
---
dependencies:
- {role: nginx/server}

View file

@ -0,0 +1,64 @@
---
- name: enable repository
ansible.builtin.yum_repository:
name: influxdb
baseurl: https://repos.influxdata.com/rhel/$releasever/$basearch/stable
description: InfluxDB
gpgcheck: true
gpgkey: https://repos.influxdata.com/influxdb.key
enabled: true
- name: install packages
ansible.builtin.package:
name: influxdb2
state: present
- name: create data directory
ansible.builtin.file:
path: /export/influxdb
state: directory
mode: 0755
owner: influxdb
group: influxdb
- name: link data directory
ansible.builtin.file:
path: /srv/influxdb
src: /export/influxdb
state: link
owner: root
group: "{{ ansible_wheel }}"
follow: false
- name: create config
ansible.builtin.copy:
dest: /etc/default/influxdb
src: influxdb.sysconfig
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: restart influxdb
- name: enable service
ansible.builtin.service:
name: influxdb
state: started
enabled: true
- name: allow nginx to connect influxdb
seboolean:
name: httpd_can_network_connect
state: true
persistent: true
- name: create nginx config
copy:
dest: "/etc/nginx/conf.d/{{ inventory_hostname }}/influxdb.conf"
content: |
location / {
proxy_pass http://127.0.0.1:8086/;
}
mode: 0644
owner: root
group: "{{ ansible_wheel }}"
notify: restart nginx