42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
---
|
|
- name: Ensure collector is installed
|
|
ansible.builtin.apt:
|
|
deb: 'https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.146.1/otelcol-contrib_0.146.1_linux_amd64.deb'
|
|
notify: 'restart otelcol-contrib'
|
|
|
|
- name: Ensure configuration directory is present
|
|
ansible.builtin.file:
|
|
path: '/etc/otelcol-contrib'
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure config file is present
|
|
ansible.builtin.template:
|
|
src: 'config.yaml.j2'
|
|
dest: '/etc/otelcol-contrib/config.yaml'
|
|
mode: '0644'
|
|
owner: 'root'
|
|
group: 'root'
|
|
notify: 'restart otelcol-contrib'
|
|
|
|
- name: Ensure Systemd override directory is present
|
|
ansible.builtin.file:
|
|
path: '/etc/systemd/system/otelcol-contrib.service.d'
|
|
state: 'directory'
|
|
mode: '0644'
|
|
owner: 'root'
|
|
group: 'root'
|
|
|
|
- name: Ensure Systemd override file is present
|
|
ansible.builtin.copy:
|
|
src: 'run_as_root.conf'
|
|
dest: '/etc/systemd/system/otelcol-contrib.service.d/run_as_root.conf'
|
|
mode: '0644'
|
|
owner: 'root'
|
|
group: 'root'
|
|
notify: 'restart otelcol-contrib'
|
|
|
|
- name: Ensure service is enabled
|
|
ansible.builtin.service:
|
|
name: 'otelcol-contrib'
|
|
enabled: true
|