geekoops-collectd/tasks/main.yml
felix.niederwanger@suse.com 16cd66fbea Add GitHub Actions
Adding GitHub Actions as CI
2021-03-25 16:22:25 +01:00

48 lines
1.1 KiB
YAML

---
# tasks file for geekoops-collectd
# Distribution specific vars are ALWAYS needed, so don't forget the tags here
- name: include distribution specific vars
include_vars: "{{ansible_distribution}}_{{ansible_distribution_version}}.yml"
tags: ['collectd']
- name: Install collectd
package:
name: "{{ packages }}"
# Important: Leave state: present, as we will overwrite the existing config
# when this task changes!
state: present
register: install
tags: ['collectd']
- name: Perform collectd first config
template:
src: collectd.conf.j2
dest: /etc/collectd.conf
owner: root
group: root
mode: 0640
force: true
tags: ['collectd']
when: install.changed == true
notify: restart collectd
- name: Ensure collectd is configured
template:
src: collectd.conf.j2
dest: /etc/collectd.conf
owner: root
group: root
mode: 0640
force: "{{overwrite}}"
tags: ['collectd']
when: install.changed == false
notify: restart collectd
- name: Ensure collectd is enabled
systemd:
name: collectd
state: started
enabled: true
tags: ['collectd']