add vector role
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
# ---> Ansible
|
# ---> Ansible
|
||||||
*.retry
|
*.retry
|
||||||
|
ansible.cfg
|
||||||
|
|
||||||
|
|||||||
9
roles/vector/defaults/main.yml
Normal file
9
roles/vector/defaults/main.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
vector_setup:
|
||||||
|
config_path: /etc/vector/vector.yaml
|
||||||
|
vector_config:
|
||||||
|
hostname: ""
|
||||||
|
journald:
|
||||||
|
enbled: true
|
||||||
|
loki:
|
||||||
|
address: ""
|
||||||
6
roles/vector/handlers/main.yml
Normal file
6
roles/vector/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Restart Service
|
||||||
|
become: true
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: vector
|
||||||
|
state: restarted
|
||||||
9
roles/vector/meta/main.yml
Normal file
9
roles/vector/meta/main.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your role description
|
||||||
|
company: your company (optional)
|
||||||
|
license: license (GPL-2.0-or-later, MIT, etc)
|
||||||
|
min_ansible_version: 2.1
|
||||||
|
galaxy_tags: []
|
||||||
|
dependencies: []
|
||||||
|
|
||||||
25
roles/vector/tasks/main.yml
Normal file
25
roles/vector/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- name: Install Vector via official script
|
||||||
|
ansible.builtin.shell: bash -c "$(curl -L https://setup.vector.dev)"
|
||||||
|
args:
|
||||||
|
creates: /usr/bin/vector
|
||||||
|
|
||||||
|
- name: Install Vector
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: vector
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Deploy config
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: templates/vector.yaml.j2
|
||||||
|
dest: "{{ vector_setup.config_path }}"
|
||||||
|
owner: root
|
||||||
|
notify:
|
||||||
|
- Restart Service
|
||||||
|
|
||||||
|
- name: Enable and start Vector service
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: vector
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
34
roles/vector/templates/vector.yaml.j2
Normal file
34
roles/vector/templates/vector.yaml.j2
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
sources:
|
||||||
|
journald:
|
||||||
|
type: journald
|
||||||
|
|
||||||
|
transforms:
|
||||||
|
tag_journald:
|
||||||
|
type: remap
|
||||||
|
inputs:
|
||||||
|
- journald
|
||||||
|
source: |
|
||||||
|
.source = "journald"
|
||||||
|
.unit = ._SYSTEMD_UNIT
|
||||||
|
.process = ._COMM
|
||||||
|
.priority = .PRIORITY
|
||||||
|
.host = "{{ vector_config.hostname }}"
|
||||||
|
|
||||||
|
sinks:
|
||||||
|
loki:
|
||||||
|
type: loki
|
||||||
|
inputs:
|
||||||
|
- tag_journald
|
||||||
|
endpoint: "{{ vector_config.loki.address }}"
|
||||||
|
healthcheck:
|
||||||
|
enabled: false
|
||||||
|
encoding:
|
||||||
|
codec: json
|
||||||
|
labels:
|
||||||
|
{% raw %}
|
||||||
|
host: "{{ .host }}"
|
||||||
|
source: "{{ .source }}"
|
||||||
|
unit: "{{ .unit }}"
|
||||||
|
process: "{{ .process }}"
|
||||||
|
priority: "{{ .priority }}"
|
||||||
|
{% endraw %}
|
||||||
6
roles/vector/tests/playbook.yaml
Normal file
6
roles/vector/tests/playbook.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
- name: Vector Install
|
||||||
|
hosts:
|
||||||
|
- all
|
||||||
|
roles:
|
||||||
|
- role: vector
|
||||||
|
|
||||||
Reference in New Issue
Block a user