diff --git a/ansible/group_vars/all/grafana b/ansible/group_vars/all/grafana new file mode 100644 index 000000000..5c7d05a55 --- /dev/null +++ b/ansible/group_vars/all/grafana @@ -0,0 +1,50 @@ +--- +############################################################################### +# Grafana configuration. + +# Grafana local admin user name. If you are deploying Monasca Grafana this +# should not conflict with an OpenStack user name. +#grafana_local_admin_user_name: +grafana_local_admin_user_name: "grafana_admin" + +# Path to git repo containing Grafana dashboards. Eg. +# https://github.com/stackhpc/grafana-reference-dashboards.git +#grafana_monitoring_node_dashboard_repo: +grafana_monitoring_node_dashboard_repo: + +# Path to which Grafana dashboards will be cloned to a monitoring node +#grafana_monitoring_node_dashboard_repo_path: +grafana_monitoring_node_dashboard_repo_path: "/var/opt/grafana/" + +# The Grafana organisation for the control plane. Note that for Monasca +# Grafana with domain support the format is: +# organisation_name@openstack_domain +#grafana_control_plane_organisation: +grafana_control_plane_organisation: "control_plane" + +# A list of datasources to configure. See the stackhpc.grafana-conf role +# for a list of supported datasources. Example: +# +# grafana_datasources: +# monasca_api: +# port: 8082 +# host: monasca-api +# monasca_log_api: +# port: 5607 +# host: monasca-log-api +# elasticsearch: +# port: 9200 +# host: monasca-elasticsearch +# project_id: "some_id" +# +#grafana_datasources: +grafana_datasources: + +# The path, relative to the grafana_monitoring_node_dashboard_repo_path +# containing the dashboards. Eg. /prometheus/control_plane +#grafana_monitoring_node_dashboard_path: +grafana_monitoring_node_dashboard_path: + +############################################################################### +# Dummy variable to allow Ansible to accept this file. +workaround_ansible_issue_8743: yes diff --git a/ansible/overcloud-grafana-configure.yml b/ansible/overcloud-grafana-configure.yml new file mode 100644 index 000000000..43961d614 --- /dev/null +++ b/ansible/overcloud-grafana-configure.yml @@ -0,0 +1,44 @@ +--- +- name: Check whether Grafana is enabled + hosts: overcloud + tags: + - grafana + tasks: + - name: Create monitoring group with grafana enabled + group_by: + key: "monitoring_with_grafana_enabled_{{ kolla_enable_grafana | bool }}" + +- name: Configure control plane monitoring for Grafana + # Only required to run on a single host. + hosts: monitoring_with_grafana_enabled_True[0] + gather_facts: False + tags: + - grafana + pre_tasks: + - name: Set fact for the VIP address + set_fact: + kolla_internal_vip_address: "{{ internal_net_name | net_vip_address }}" + when: kolla_enable_haproxy | bool + + - name: Set fact for the VIP address + set_fact: + kolla_internal_vip_address: "{{ internal_net_name | net_ip(network_host) }}" + when: not kolla_enable_haproxy | bool + + - name: Clone dashboards + git: + repo: "{{ grafana_monitoring_node_dashboard_repo }}" + dest: "{{ grafana_monitoring_node_dashboard_repo_path }}" + when: grafana_monitoring_node_dashboard_repo | bool + become: True + + - name: Include Kolla passwords for Grafana local admin account credentials + include_vars: "{{ kayobe_config_path }}/kolla/passwords.yml" + roles: + - role: stackhpc.grafana-conf + grafana_conf_organisation: "{{ grafana_control_plane_organisation }}" + grafana_conf_grafana_admin_user: "{{ grafana_local_admin_user_name }}" + grafana_conf_grafana_admin_pass: "{{ grafana_admin_password }}" + grafana_conf_grafana_url: "http://{{ kolla_internal_vip_address }}:3000" + grafana_conf_grafana_datasources: "{{ grafana_datasources }}" + grafana_conf_grafana_dashboards: "{{ grafana_monitoring_node_dashboard_repo_path }}{{ grafana_monitoring_node_dashboard_path }}" diff --git a/doc/source/deployment.rst b/doc/source/deployment.rst index 228b60014..29f03b5ad 100644 --- a/doc/source/deployment.rst +++ b/doc/source/deployment.rst @@ -379,3 +379,4 @@ This will perform the following tasks: - Register Ironic Python Agent (IPA) images with glance - Register introspection rules with ironic inspector - Register a provisioning network and subnet with neutron +- Configure Grafana organisations, dashboards and datasources diff --git a/etc/kayobe/grafana.yml b/etc/kayobe/grafana.yml new file mode 100644 index 000000000..8bac06869 --- /dev/null +++ b/etc/kayobe/grafana.yml @@ -0,0 +1,44 @@ +--- +############################################################################### +# Grafana configuration. + +# Grafana local admin user name. If you are deploying Monasca Grafana this +# should not conflict with an OpenStack user name. +#grafana_local_admin_user_name: + +# Path to git repo containing Grafana dashboards. Eg. +# https://github.com/stackhpc/grafana-reference-dashboards.git +#grafana_monitoring_node_dashboard_repo: + +# Path to which Grafana dashboards will be cloned to a monitoring node +#grafana_monitoring_node_dashboard_repo_path: + +# The Grafana organisation for the control plane. Note that for Monasca +# Grafana with domain support the format is: +# organisation_name@openstack_domain +#grafana_control_plane_organisation: + +# A list of datasources to configure. See the stackhpc.grafana-conf role +# for a list of supported datasources. Example: +# +# grafana_datasources: +# monasca_api: +# port: 8082 +# host: monasca-api +# monasca_log_api: +# port: 5607 +# host: monasca-log-api +# elasticsearch: +# port: 9200 +# host: monasca-elasticsearch +# project_id: "some_id" +# +#grafana_datasources: + +# The path, relative to the grafana_monitoring_node_dashboard_repo_path +# containing the dashboards. Eg. /prometheus/control_plane +#grafana_monitoring_node_dashboard_path: + +############################################################################### +# Dummy variable to allow Ansible to accept this file. +workaround_ansible_issue_8743: yes diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index 0640f9966..fb281147f 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -1087,6 +1087,7 @@ class OvercloudPostConfigure(KayobeAnsibleMixin, VaultMixin, Command): * Register ironic inspector introspection rules with the overcloud inspector service. * Register a provisioning network with glance. + * Configure Grafana for control plane. """ def take_action(self, parsed_args): @@ -1094,7 +1095,7 @@ class OvercloudPostConfigure(KayobeAnsibleMixin, VaultMixin, Command): playbooks = _build_playbook_list( "overcloud-ipa-images", "overcloud-introspection-rules", "overcloud-introspection-rules-dell-lldp-workaround", - "provision-net") + "provision-net", "overcloud-grafana-configure") self.run_kayobe_playbooks(parsed_args, playbooks) diff --git a/requirements.yml b/requirements.yml index 9dcd0524f..0cc06d688 100644 --- a/requirements.yml +++ b/requirements.yml @@ -10,6 +10,7 @@ name: singleplatform-eng.users - src: stackhpc.drac - src: stackhpc.drac-facts +- src: stackhpc.grafana-conf - src: stackhpc.libvirt-host - src: stackhpc.libvirt-vm - src: stackhpc.os-flavors