telegraf: drop agent configuration stuff
Servers will be switched to Prometheus. Telegraf remains as a SNMP proxy (see following commit).
This commit is contained in:
parent
d347fd7215
commit
6600a6fa36
5 changed files with 21 additions and 100 deletions
|
@ -1,31 +0,0 @@
|
||||||
- name: Add influxdb repository
|
|
||||||
deb822_repository:
|
|
||||||
name: influxdata
|
|
||||||
uris: https://repos.influxdata.com/debian
|
|
||||||
suites: stable
|
|
||||||
components: main
|
|
||||||
architectures: amd64
|
|
||||||
signed_by: https://repos.influxdata.com/influxdata-archive.key
|
|
||||||
notify: update package cache
|
|
||||||
|
|
||||||
- meta: flush_handlers
|
|
||||||
|
|
||||||
- name: Install telegraf
|
|
||||||
package:
|
|
||||||
name: telegraf
|
|
||||||
|
|
||||||
- name: Configure telegraf
|
|
||||||
when: not ansible_check_mode
|
|
||||||
template:
|
|
||||||
dest: /etc/telegraf/telegraf.d/output.conf
|
|
||||||
src: output.conf.j2
|
|
||||||
owner: telegraf
|
|
||||||
group: telegraf
|
|
||||||
mode: 0640
|
|
||||||
notify: restart telegraf
|
|
||||||
|
|
||||||
- name: Enable telegraf
|
|
||||||
service:
|
|
||||||
name: telegraf
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
|
@ -1,11 +1,22 @@
|
||||||
- name: Get influxdb info
|
- name: Add telegraf package repo on Debian
|
||||||
set_fact:
|
|
||||||
influxdb_info: '{{ lookup("passwordstore", "vm/"~influxdb_host, returnall=true, missing="empty") | from_yaml }}'
|
|
||||||
|
|
||||||
- name: Create influxdb token for this host
|
|
||||||
include_tasks: token.yml
|
|
||||||
when: 'not ansible_check_mode and "influxdb_token" not in password'
|
|
||||||
|
|
||||||
- name: Install telegraf on Debian
|
|
||||||
include_tasks: debian.yml
|
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
deb822_repository:
|
||||||
|
name: influxdata
|
||||||
|
uris: https://repos.influxdata.com/debian
|
||||||
|
suites: stable
|
||||||
|
components: main
|
||||||
|
architectures: amd64
|
||||||
|
signed_by: https://repos.influxdata.com/influxdata-archive.key
|
||||||
|
notify: update package cache
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
|
||||||
|
- name: Install telegraf
|
||||||
|
package:
|
||||||
|
name: telegraf
|
||||||
|
|
||||||
|
- name: Enable telegraf service
|
||||||
|
service:
|
||||||
|
name: telegraf
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
- name: Get influxdb organization ID
|
|
||||||
delegate_to: localhost
|
|
||||||
uri:
|
|
||||||
url: '{{ influxdb_info.influxdb_url }}/api/v2/orgs'
|
|
||||||
headers:
|
|
||||||
Authorization: Token {{ influxdb_info.influxdb_operator_token }}
|
|
||||||
register: response
|
|
||||||
|
|
||||||
- name: Parse influxdb orgID
|
|
||||||
set_fact:
|
|
||||||
influxdb_orgID: '{{ response.json.orgs | selectattr("name", "==", influxdb_info.influxdb_org) | map(attribute="id") | first }}'
|
|
||||||
|
|
||||||
- name: Get influxdb bucket ID
|
|
||||||
delegate_to: localhost
|
|
||||||
uri:
|
|
||||||
url: '{{ influxdb_info.influxdb_url }}/api/v2/buckets?orgID={{ influxdb_orgID }}'
|
|
||||||
headers:
|
|
||||||
Authorization: Token {{ influxdb_info.influxdb_operator_token }}
|
|
||||||
register: response
|
|
||||||
|
|
||||||
- name: Parse influxdb bucketID
|
|
||||||
set_fact:
|
|
||||||
influxdb_bucketID: '{{ response.json.buckets | selectattr("name", "==", "servers") | map(attribute="id") | first }}'
|
|
||||||
|
|
||||||
- name: Create influxdb token
|
|
||||||
delegate_to: localhost
|
|
||||||
uri:
|
|
||||||
url: '{{ influxdb_info.influxdb_url }}/api/v2/authorizations'
|
|
||||||
method: POST
|
|
||||||
body_format: json
|
|
||||||
status_code: 201
|
|
||||||
headers:
|
|
||||||
Authorization: Token {{ influxdb_info.influxdb_operator_token }}
|
|
||||||
Content-Type: application/json
|
|
||||||
body: |
|
|
||||||
{
|
|
||||||
"description": "{{ inventory_hostname }}",
|
|
||||||
"orgID": "{{ influxdb_orgID }}",
|
|
||||||
"permissions": [{ "action": "write", "resource": { "type": "buckets", "id": "{{ influxdb_bucketID }}" } }]
|
|
||||||
}
|
|
||||||
register: response
|
|
||||||
|
|
||||||
- name: Parse influxdb token
|
|
||||||
set_fact:
|
|
||||||
influxdb_token: '{{ response.json.token }}'
|
|
||||||
|
|
||||||
# Ansible’s passwordstore lookup plugin should be able to do that but is pretty broken,
|
|
||||||
# so we do it manually.
|
|
||||||
- name: Store influxdb token in password store
|
|
||||||
delegate_to: localhost
|
|
||||||
command:
|
|
||||||
cmd: 'pass insert --force --multiline {{ ("vm/" if is_virtual else "host/")~inventory_hostname }}'
|
|
||||||
stdin: '{{ password | to_nice_yaml(sort_keys=false) }}influxdb_token: {{ influxdb_token }}'
|
|
|
@ -1,5 +0,0 @@
|
||||||
[[outputs.influxdb_v2]]
|
|
||||||
urls = ["{{ influxdb_info.influxdb_url }}"]
|
|
||||||
organization = "{{ influxdb_info.influxdb_org }}"
|
|
||||||
bucket = "{{ influxdb_info.influxdb_bucket }}"
|
|
||||||
token = "{{ influxdb_token | default(password.influxdb_token) }}"
|
|
|
@ -16,7 +16,6 @@
|
||||||
- hosts: ceph-*
|
- hosts: ceph-*
|
||||||
roles:
|
roles:
|
||||||
- frr
|
- frr
|
||||||
- telegraf
|
|
||||||
- ceph
|
- ceph
|
||||||
|
|
||||||
- hosts: mgmt-gw
|
- hosts: mgmt-gw
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue