Browse Source

deploy prometheus

master
Nicolas Massé 8 years ago
parent
commit
2f6a12dd4d
  1. 60
      playbooks/deploy-prometheus.yml
  2. 8
      playbooks/site.yml
  3. 7
      prod.hosts

60
playbooks/deploy-prometheus.yml

@ -0,0 +1,60 @@
---
- name: Deploy Prometheus on OpenShift
hosts: itix
become: yes
vars:
itix_openshift_docker_images_repo_url: https://github.com/nmasse-itix/OpenShift-Docker-Images.git
itix_prometheus_project: openshift-metrics
itix_grafana_route: grafana.{{ openshift_master_default_subdomain }}
itix_prometheus_route: prometheus.{{ openshift_master_default_subdomain }}
itix_alerts_route: prometheus-alerts.{{ openshift_master_default_subdomain }}
tasks:
- name: Create a temporary directory
tempfile:
state: directory
register: tempfile
- name: Clone the nmasse-itix/OpenShift-Docker-Images GIT repository
git:
repo: '{{ itix_openshift_docker_images_repo_url }}'
dest: '{{ tempfile.path }}'
version: '{{ itix_openshift_docker_images_repo_tag|default(''master'') }}'
- name: Process the grafana-prometheus-storage template
command: oc process -f '{{ tempfile.path }}/grafana/grafana-prometheus-storage.yaml' -p 'NAMESPACE={{ itix_prometheus_project }}'
register: oc_process
- set_fact:
grafana_prometheus_storage: '{{ oc_process.stdout }}'
- name: Process the grafana-prometheus template
command: oc process -f '{{ tempfile.path }}/grafana/grafana-prometheus.yaml' -p 'NAMESPACE={{ itix_prometheus_project }}' -p 'PROMETHEUS_ROUTE_HOSTNAME={{ itix_prometheus_route }}' -p 'ALERTS_ROUTE_HOSTNAME={{ itix_alerts_route }}'
register: oc_process
- set_fact:
grafana_prometheus: '{{ oc_process.stdout }}'
- name: Process the grafana-base template
command: oc process -f '{{ tempfile.path }}/grafana/grafana-base.yaml' -p 'NAMESPACE={{ itix_prometheus_project }}' -p 'GRAFANA_ROUTE_HOSTNAME={{ itix_grafana_route }}'
register: oc_process
- set_fact:
grafana_base: '{{ oc_process.stdout }}'
- name: Create the objects
command: oc create -f -
args:
stdin: '{{ item|to_json }}'
register: oc
failed_when: oc.rc > 0 and 'Error from server (AlreadyExists):' not in oc.stderr
changed_when: oc.rc == 0
with_items:
- '{{ grafana_prometheus_storage }}'
- '{{ grafana_prometheus }}'
- '{{ grafana_base }}'
- name: Delete the temporary directory
file:
path: '{{ tempfile.path }}'
state: absent

8
playbooks/site.yml

@ -5,13 +5,15 @@
- include: "preparation.yml" - include: "preparation.yml"
# Launch the OpenShift Installer Playbook # Launch the OpenShift Installer Playbook
- include: "../openshift-ansible/playbooks/byo/openshift-clister/config.yml" - include: "../openshift-ansible/playbooks/byo/openshift-cluster/config.yml"
- include: "post-install.yml" - include: "post-install.yml"
# Install Prometheus # Update the default templates and image streams
- include: "../openshift-ansible/playbooks/byo/openshift-cluster/openshift-prometheus.yml" - include: "../openshift-ansible/playbooks/byo/openshift-master/additional_config.yml"
- include: "provision-global-templates-and-imagestreams.yml" - include: "provision-global-templates-and-imagestreams.yml"
- include: "deploy-prometheus.yml"
- include: "configure-openshift-access-control.yml" - include: "configure-openshift-access-control.yml"

7
prod.hosts

@ -6,6 +6,7 @@ itix_dns_suffix=itix.fr
itix_openshift_version=3.7 itix_openshift_version=3.7
itix_application_templates_repo_tag=ose-v1.4.7 itix_application_templates_repo_tag=ose-v1.4.7
itix_openshift_origin_repo_tag=release-3.7 itix_openshift_origin_repo_tag=release-3.7
itix_openshift_docker_images_repo_tag=master
[itix:children] [itix:children]
masters masters
@ -35,12 +36,6 @@ nodes
etcd etcd
[OSEv3:vars] [OSEv3:vars]
# Deploy Prometheus
openshift_hosted_prometheus_deploy=true
openshift_prometheus_storage_type='pvc'
openshift_prometheus_alertmanager_storage_type='pvc'
openshift_prometheus_alertbuffer_storage_type='pvc'
# #
# Starting with 3.6, default templates and imagestreams can be left out # Starting with 3.6, default templates and imagestreams can be left out
# see https://bugzilla.redhat.com/show_bug.cgi?id=1506578 # see https://bugzilla.redhat.com/show_bug.cgi?id=1506578

Loading…
Cancel
Save