ceph-ansible/roles/ceph-node-exporter/tasks/setup_container.yml

33 lines
896 B
YAML
Raw Normal View History

---
- name: make sure the node_exporter service is down
service:
name: node_exporter
state: stopped
failed_when: false
# Make sure we re-create the container
- name: remove old node-exporter container
command: "{{ container_binary }} rm -f node-exporter"
changed_when: false
failed_when: false
- name: start node-exporter container
shell: |
{{ container_binary }} run --detach --name node-exporter \
-v /proc:/host/proc:ro -v /sys:/host/sys:ro \
--net=host \
{{ node_exporter_container_image }} \
'--path.procfs=/host/proc' \
'--path.sysfs=/host/sys' \
'--no-collector.timex'
notify: restart node-exporter service
- name: ship systemd service
template:
src: node_exporter.service.j2
dest: "/etc/systemd/system/node_exporter.service"
owner: root
group: root
mode: 0644
notify: restart node-exporter service