main.yaml 787 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. - name: Create temp directory for doing work in on target
  3. command: mktemp -td openshift-prometheus-ansible-XXXXXX
  4. register: mktemp
  5. changed_when: False
  6. - set_fact:
  7. tempdir: "{{ mktemp.stdout }}"
  8. - name: Create templates subdirectory
  9. file:
  10. state: directory
  11. path: "{{ tempdir }}/{{ item }}"
  12. mode: 0755
  13. changed_when: False
  14. with_items:
  15. - templates
  16. - include_tasks: install_prometheus.yaml
  17. when: openshift_prometheus_state == 'present'
  18. - include_tasks: uninstall_prometheus.yaml
  19. when: openshift_prometheus_state == 'absent'
  20. - include_tasks: install_node_exporter.yaml
  21. when: openshift_prometheus_node_exporter_install | default(true) | bool
  22. - name: Delete temp directory
  23. file:
  24. name: "{{ tempdir }}"
  25. state: absent
  26. changed_when: False