main.yaml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. - name: check that hawkular_metrics_hostname is set
  3. fail: msg='the openshift_metrics_hawkular_metrics_hostname variable is required'
  4. when: openshift_metrics_hawkular_metrics_hostname is not defined
  5. - name: check the value of openshift_metrics_hawkular_cassandra_storage_type
  6. fail:
  7. msg: >
  8. openshift_metrics_hawkular_cassandra_storage_type ({{ openshift_metrics_hawkular_cassandra_storage_type }})
  9. is invalid, must be one of: emptydir, pv, dynamic
  10. when: openshift_metrics_hawkular_cassandra_storage_type not in openshift_metrics_hawkular_cassandra_storage_types
  11. - name: Create temp directory for doing work in
  12. command: mktemp -td openshift-metrics-ansible-XXXXXX
  13. register: mktemp
  14. changed_when: False
  15. - debug: msg="Created temp dir {{mktemp.stdout}}"
  16. - name: Create temp directory for all our templates
  17. file: path={{mktemp.stdout}}/templates state=directory mode=0755
  18. changed_when: False
  19. - name: Copy the admin client config(s)
  20. command: >
  21. cp {{ openshift.common.config_base}}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  22. changed_when: False
  23. check_mode: no
  24. tags: metrics_init
  25. - include: "{{role_path}}/tasks/install_metrics.yaml"
  26. when: openshift_metrics_install_metrics | default(false) | bool
  27. - include: "{{role_path}}/tasks/uninstall_metrics.yaml"
  28. when: not openshift_metrics_install_metrics | default(false) | bool
  29. - name: create objects
  30. command: >
  31. {{ openshift.common.client_binary }} -n {{ openshift_metrics_project }}
  32. --config={{ mktemp.stdout }}/admin.kubeconfig
  33. apply -f {{ item }}
  34. with_fileglob:
  35. - "{{ mktemp.stdout }}/templates/*.yaml"