main.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ---
  2. - local_action: shell python -c 'import passlib' 2>/dev/null || echo not installed
  3. register: passlib_result
  4. become: false
  5. - name: Check that python-passlib is available on the control host
  6. assert:
  7. that:
  8. - "'not installed' not in passlib_result.stdout"
  9. msg: "python-passlib rpm must be installed on control host"
  10. - name: Create temp directory for doing work in on target
  11. command: mktemp -td openshift-metrics-ansible-XXXXXX
  12. register: mktemp
  13. changed_when: False
  14. - name: Create temp directory for all our templates
  15. file: path={{mktemp.stdout}}/templates state=directory mode=0755
  16. changed_when: False
  17. when: openshift_metrics_install_metrics | bool
  18. - name: Create temp directory local on control node
  19. local_action: command mktemp -d
  20. register: local_tmp
  21. changed_when: False
  22. vars:
  23. ansible_become: false
  24. - name: Copy the admin client config(s)
  25. command: >
  26. cp {{ openshift.common.config_base}}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  27. changed_when: False
  28. check_mode: no
  29. tags: metrics_init
  30. - include_tasks: install_metrics.yaml
  31. when:
  32. - openshift_metrics_install_metrics | bool
  33. - include_tasks: uninstall_metrics.yaml
  34. when:
  35. - not openshift_metrics_install_metrics | bool
  36. - include_tasks: uninstall_hosa.yaml
  37. when: not openshift_metrics_install_hawkular_agent | bool
  38. - name: Delete temp directory
  39. local_action: file path=local_tmp.stdout state=absent
  40. tags: metrics_cleanup
  41. changed_when: False
  42. check_mode: no
  43. vars:
  44. ansible_become: false