Add InfluxDB role
This commit is contained in:
12
roles/influxdb/tasks/Debian.yaml
Normal file
12
roles/influxdb/tasks/Debian.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: add influx apt key
|
||||
apt_key:
|
||||
url: https://repos.influxdata.com/influxdb.key
|
||||
state: present
|
||||
|
||||
- name: configure apt repository
|
||||
apt_repository:
|
||||
repo: "deb https://repos.influxdata.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
|
||||
filename: influxdb
|
||||
update_cache: yes
|
||||
state: present
|
44
roles/influxdb/tasks/main.yaml
Normal file
44
roles/influxdb/tasks/main.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
- name: gather os specific variables
|
||||
include_vars: "{{ lookup('first_found', possible_files) }}"
|
||||
vars:
|
||||
possible_files:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- vars
|
||||
|
||||
- name: include os specific tasks
|
||||
include_tasks: "{{ lookup('first_found', possible_files) }}"
|
||||
vars:
|
||||
possible_files:
|
||||
files:
|
||||
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
paths:
|
||||
- tasks
|
||||
|
||||
- name: install package
|
||||
package:
|
||||
name: "{{ influxdb_package_name }}"
|
||||
state: "{{ influxdb_package_state }}"
|
||||
|
||||
- name: configure
|
||||
template:
|
||||
src: influxdb.conf.j2
|
||||
dest: /etc/influxdb/influxdb.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: reload influxdb
|
||||
|
||||
- name: manage service
|
||||
service:
|
||||
name: "{{ influxdb_service_name }}"
|
||||
state: "{{ influxdb_service_state }}"
|
||||
enabled: "{{ influxdb_service_enabled }}"
|
Reference in New Issue
Block a user