58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
|
---
|
||
|
|
||
|
# https://www.influxdata.com/blog/deploying-influxdb-with-ansible/
|
||
|
|
||
|
- name: Ensure apt-transport-https
|
||
|
apt:
|
||
|
name: apt-transport-https
|
||
|
state: present
|
||
|
update_cache: yes
|
||
|
|
||
|
- name: Ensure python dependencies
|
||
|
apt:
|
||
|
name: [ 'python-requests', 'python-pip' ]
|
||
|
state: present
|
||
|
|
||
|
- name: Ensure python-influxdb
|
||
|
pip:
|
||
|
name: influxdb
|
||
|
state: present
|
||
|
|
||
|
- name: Ensure Influx Data signing key
|
||
|
apt_key:
|
||
|
url: "{{ influx.repo }}"
|
||
|
state: present
|
||
|
|
||
|
- name: Ensure Influx Data repo
|
||
|
apt_repository:
|
||
|
repo: deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable
|
||
|
state: present
|
||
|
filename: influxdata
|
||
|
|
||
|
- name: Ensure Influx pkg
|
||
|
apt:
|
||
|
name: influxdb
|
||
|
state: present
|
||
|
update_cache: yes
|
||
|
|
||
|
- name: Ensure influx is started and enabled
|
||
|
systemd:
|
||
|
name: influxdb
|
||
|
state: started
|
||
|
enabled: yes
|
||
|
|
||
|
- name: Check if admin user is created
|
||
|
stat:
|
||
|
path: /etc/influxdb/admin
|
||
|
register: admin
|
||
|
|
||
|
- name: Create admin user
|
||
|
import_tasks: admin.yml
|
||
|
when: admin.stat.exists == False
|
||
|
|
||
|
- name: Push influxdb config, with auth enable
|
||
|
template:
|
||
|
src: influxdb.conf.j2
|
||
|
dest: /etc/influxdb/influxdb.conf
|
||
|
notify: reload influxdb
|