73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
---
|
|
- 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
|
|
|
|
# https://github.com/influxdata/influxdb/issues/22435
|
|
- name: fix logrotate errors
|
|
ansible.builtin.file:
|
|
path: /etc/logrotate.d/influxdb
|
|
state: file
|
|
mode: 0644
|
|
owner: root
|
|
group: "{{ ansible_wheel }}"
|
|
|
|
- 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
|