Migration playbook:
- name: Cleanup old promtail install
hosts: all
tasks:
- name: Stop and disable old service
when: prometheus_agent.agents.promtail.enable
service:
name: grafana-promtail
state: stopped
enabled: false
- name: Migrate state dir
when: prometheus_agent.agents.promtail.enable
copy:
src: /var/lib/grafana-promtail/
dest: /var/lib/promtail/
remote_src: yes
- name: Uninstall old package
when: prometheus_agent.agents.promtail.enable
apt:
name: grafana-promtail
state: absent
purge: true # Removes user, group and /var/lib/grafana-promtail
- name: create promtail group
when: prometheus_agent.agents.promtail.enable
group:
name: promtail
system: true
- name: create promtail user
when: prometheus_agent.agents.promtail.enable
user:
name: promtail
system: true
group: promtail
home: /var/lib/promtail
- name: Fix state dir owner and group
when: prometheus_agent.agents.promtail.enable
file:
name: /var/lib/promtail/
state: directory
recurse: true
owner: promtail
group: promtail
|
||
|---|---|---|
| .. | ||
| main.yml | ||