summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--playbooks/common/openshift-cluster/openshift_metrics.yml4
-rw-r--r--roles/openshift_metrics/defaults/main.yaml4
-rw-r--r--roles/openshift_metrics/tasks/install_metrics.yaml24
-rw-r--r--roles/openshift_metrics/tasks/install_support.yaml5
-rw-r--r--roles/openshift_metrics/tasks/main.yaml27
-rw-r--r--roles/openshift_metrics/tasks/uninstall_metrics.yaml (renamed from roles/openshift_metrics/tasks/cleanup.yaml)0
6 files changed, 38 insertions, 26 deletions
diff --git a/playbooks/common/openshift-cluster/openshift_metrics.yml b/playbooks/common/openshift-cluster/openshift_metrics.yml
new file mode 100644
index 000000000..3a8a4cf77
--- /dev/null
+++ b/playbooks/common/openshift-cluster/openshift_metrics.yml
@@ -0,0 +1,4 @@
+- name: OpenShift Metrics
+ hosts: oo_first_master
+ roles:
+ - openshift_metrics
diff --git a/roles/openshift_metrics/defaults/main.yaml b/roles/openshift_metrics/defaults/main.yaml
index 4b5ecadbf..7f9a5f36a 100644
--- a/roles/openshift_metrics/defaults/main.yaml
+++ b/roles/openshift_metrics/defaults/main.yaml
@@ -1,4 +1,5 @@
---
+openshift_metrics_install_metrics: True
openshift_metrics_image_prefix: docker.io/openshift/origin-
openshift_metrics_image_version: latest
openshift_metrics_master_url: https://kubernetes.default.svc.cluster.local
@@ -10,8 +11,7 @@ openshift_metrics_hawkular_cassandra_nodes: 1
openshift_metrics_hawkular_cassandra_storage_type: emptydir
openshift_metrics_hawkular_cassandra_pv_prefix: metrics-cassandra
openshift_metrics_hawkular_cassandra_pv_size: 10Gi
-openshift_metrics_certs_dir: >
- {{ openshift.common.config_base }}/master/metrics
+openshift_metrics_certs_dir: "{{ openshift.common.config_base }}/master/metrics"
openshift_metrics_heapster_standalone: False
openshift_metrics_heapster_allowed_users: system:master-proxy
diff --git a/roles/openshift_metrics/tasks/install_metrics.yaml b/roles/openshift_metrics/tasks/install_metrics.yaml
index 5d95fa112..db023e6a2 100644
--- a/roles/openshift_metrics/tasks/install_metrics.yaml
+++ b/roles/openshift_metrics/tasks/install_metrics.yaml
@@ -1,17 +1,9 @@
---
-# This is the base configuration for installing the other components
-- name: Create temp directory for doing work in
- command: mktemp -td openshift-metrics-ansible-XXXXXX
- register: mktemp
- changed_when: False
-
-- debug: msg="Created temp dir {{mktemp.stdout}}"
-
-- name: Create temp directory for all our templates
- file: path={{mktemp.stdout}}/templates state=directory mode=0755
- changed_when: False
-
-- include: generate_certificates.yaml
-- include: generate_serviceaccounts.yaml
-- include: generate_services.yaml
-- include: generate_rolebindings.yaml
+- name: Install Metrics
+ include: "{{ role_path }}/tasks/install_{{ include_file }}.yaml"
+ with_items:
+ - support
+ - heapster
+ - hawkular
+ loop_control:
+ loop_var: include_file
diff --git a/roles/openshift_metrics/tasks/install_support.yaml b/roles/openshift_metrics/tasks/install_support.yaml
new file mode 100644
index 000000000..b0e4bec80
--- /dev/null
+++ b/roles/openshift_metrics/tasks/install_support.yaml
@@ -0,0 +1,5 @@
+---
+- include: generate_certificates.yaml
+- include: generate_serviceaccounts.yaml
+- include: generate_services.yaml
+- include: generate_rolebindings.yaml
diff --git a/roles/openshift_metrics/tasks/main.yaml b/roles/openshift_metrics/tasks/main.yaml
index 79aae1e0b..adedd4069 100644
--- a/roles/openshift_metrics/tasks/main.yaml
+++ b/roles/openshift_metrics/tasks/main.yaml
@@ -2,20 +2,31 @@
- name: check that hawkular_metrics_hostname is set
fail: msg='the openshift_metrics_hawkular_metrics_hostname variable is required'
when: "{{ openshift_metrics_hawkular_metrics_hostname is not defined }}"
+
- name: check the value of openshift_metrics_hawkular_cassandra_storage_type
fail:
msg: >
openshift_metrics_hawkular_cassandra_storage_type ({{ openshift_metrics_hawkular_cassandra_storage_type }})
is invalid, must be one of: emptydir, pv, dynamic
when: openshift_metrics_hawkular_cassandra_storage_type not in openshift_metrics_hawkular_cassandra_storage_types
-- name: Install Metrics
- include: "{{ role_path }}/tasks/install_{{ include_file }}.yaml"
- with_items:
- - metrics
- - heapster
- - hawkular
- loop_control:
- loop_var: include_file
+
+- name: Create temp directory for doing work in
+ command: mktemp -td openshift-metrics-ansible-XXXXXX
+ register: mktemp
+ changed_when: False
+
+- debug: msg="Created temp dir {{mktemp.stdout}}"
+
+- name: Create temp directory for all our templates
+ file: path={{mktemp.stdout}}/templates state=directory mode=0755
+ changed_when: False
+
+- include: "{{role_path}}/tasks/install_metrics.yaml"
+ when: openshift_metrics_install_metrics | default(false) | bool
+
+- include: "{{role_path}}/tasks/uninstall_metrics.yaml"
+ when: not openshift_metrics_install_metrics | default(false) | bool
+
- name: create objects
command: >
{{ openshift.common.client_binary }} -n '{{ openshift_metrics_project }}'
diff --git a/roles/openshift_metrics/tasks/cleanup.yaml b/roles/openshift_metrics/tasks/uninstall_metrics.yaml
index a29faef31..a29faef31 100644
--- a/roles/openshift_metrics/tasks/cleanup.yaml
+++ b/roles/openshift_metrics/tasks/uninstall_metrics.yaml