install.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. - name: Create temp directory for doing work in on target
  3. command: mktemp -td openshift-cluster-monitoring-ansible-XXXXXX
  4. register: mktemp
  5. changed_when: False
  6. - name: Copy files to temp directory
  7. copy:
  8. src: "{{ item }}"
  9. dest: "{{ mktemp.stdout }}/{{ item }}"
  10. with_items:
  11. - cluster-monitoring-operator.yaml
  12. - name: Copy admin client config
  13. command: >
  14. cp {{ openshift.common.config_base }}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  15. changed_when: false
  16. - name: Add monitoring project
  17. oc_project:
  18. state: present
  19. name: openshift-monitoring
  20. description: Openshift Monitoring
  21. node_selector: ""
  22. - name: Label monitoring namespace
  23. oc_label:
  24. state: present
  25. kind: namespace
  26. name: openshift-monitoring
  27. labels:
  28. - key: openshift.io/cluster-monitoring
  29. value: "true"
  30. - name: Apply the cluster monitoring operator template
  31. shell: >
  32. {{ openshift_client_binary }} process -f "{{ mktemp.stdout }}/{{ item }}"
  33. --param OPERATOR_IMAGE="{{ openshift_cluster_monitoring_operator_image }}"
  34. --param PROMETHEUS_OPERATOR_IMAGE="{{ openshift_cluster_monitoring_operator_prometheus_operator_repo }}"
  35. --param ALERTMANAGER_IMAGE="{{ openshift_cluster_monitoring_operator_alertmanager_repo }}"
  36. --param PROMETHEUS_IMAGE="{{ openshift_cluster_monitoring_operator_prometheus_repo }}"
  37. --param PROMETHEUS_CONFIG_RELOADER_IMAGE="{{ openshift_cluster_monitoring_operator_prometheus_reloader_repo }}"
  38. --param CONFIG_RELOADER_IMAGE="{{ openshift_cluster_monitoring_oeprator_configmap_reloader_repo }}"
  39. --param ALERTMANAGER_CONFIG="{{ openshift_cluster_monitoring_operator_alertmanager_config | b64encode }}"
  40. --param CLUSTER_ID="{{ openshift_cluster_monitoring_operator_cluster_id }}"
  41. --config={{ mktemp.stdout }}/admin.kubeconfig
  42. | {{ openshift_client_binary }} apply --config={{ mktemp.stdout }}/admin.kubeconfig -f -
  43. with_items:
  44. - cluster-monitoring-operator.yaml
  45. - name: Delete temp directory
  46. file:
  47. name: "{{ mktemp.stdout }}"
  48. state: absent
  49. changed_when: False