From 14f66504b20b75a2327b8053767bfc2696f51e99 Mon Sep 17 00:00:00 2001 From: Steve Lewis Date: Wed, 1 Jun 2016 15:27:44 -0700 Subject: [PATCH] Introduce a playbook for deploying Gnocchi As the next step in integrating Gnocchi, this playbook installs the gnocchi role. The role is enabled for the gate by default, but can be disabled consistent with other roles. It is also included in the setup-openstack.yml playbook so that linters run on the playbook. Change-Id: I2e8b32f1cc6830c479da418b04896f273c5b2b86 Depends-On: I0eb60ef7a31d873ba70c353138da252284389f28 Partial-Blueprint: role-gnocchi --- ansible-role-requirements.yml | 4 + etc/openstack_deploy/conf.d/gnocchi.yml.aio | 19 +++ etc/openstack_deploy/user_secrets.yml | 4 + .../repo_packages/openstack_services.yml | 6 + playbooks/inventory/env.d/gnocchi.yml | 41 ++++++ .../inventory/group_vars/gnocchi_all.yml | 22 ++++ playbooks/os-gnocchi-install.yml | 123 ++++++++++++++++++ playbooks/setup-openstack.yml | 1 + playbooks/utility-install.yml | 1 + playbooks/vars/configs/haproxy_config.yml | 8 ++ ...cchi-metrics-service-6a7bdda8e7e71dda.yaml | 9 ++ tests/test_inventory.py | 6 + 12 files changed, 244 insertions(+) create mode 100644 etc/openstack_deploy/conf.d/gnocchi.yml.aio create mode 100644 playbooks/inventory/env.d/gnocchi.yml create mode 100644 playbooks/inventory/group_vars/gnocchi_all.yml create mode 100644 playbooks/os-gnocchi-install.yml create mode 100644 releasenotes/notes/gnocchi-metrics-service-6a7bdda8e7e71dda.yaml diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index 4bab25c5f3..10feff6490 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -66,6 +66,10 @@ scm: git src: https://git.openstack.org/openstack/openstack-ansible-os_glance version: master +- name: os_gnocchi + src: https://git.openstack.org/openstack/openstack-ansible-os_gnocchi + scm: git + version: master - name: os_heat scm: git src: https://git.openstack.org/openstack/openstack-ansible-os_heat diff --git a/etc/openstack_deploy/conf.d/gnocchi.yml.aio b/etc/openstack_deploy/conf.d/gnocchi.yml.aio new file mode 100644 index 0000000000..d3d0cc218a --- /dev/null +++ b/etc/openstack_deploy/conf.d/gnocchi.yml.aio @@ -0,0 +1,19 @@ +--- +# Copyright 2015, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +metrics_hosts: + aio1: + ip: 172.29.236.100 + diff --git a/etc/openstack_deploy/user_secrets.yml b/etc/openstack_deploy/user_secrets.yml index 5732955272..1d6b8207b4 100644 --- a/etc/openstack_deploy/user_secrets.yml +++ b/etc/openstack_deploy/user_secrets.yml @@ -67,6 +67,10 @@ glance_service_password: glance_profiler_hmac_key: glance_rabbitmq_password: +## Gnocchi Options: +gnocchi_galera_password: +gnocchi_service_password: + ## Heat Options heat_stack_domain_admin_password: heat_container_mysql_password: diff --git a/playbooks/defaults/repo_packages/openstack_services.yml b/playbooks/defaults/repo_packages/openstack_services.yml index cf8686de91..740e37337d 100644 --- a/playbooks/defaults/repo_packages/openstack_services.yml +++ b/playbooks/defaults/repo_packages/openstack_services.yml @@ -59,6 +59,12 @@ glance_git_install_branch: 8dd23d0b9c7ca9bb521f56407f6f601db84771f9 # HEAD of "m glance_git_dest: "/opt/glance_{{ glance_git_install_branch | replace('/', '_') }}" +## Gnocchi service +gnocchi_git_repo: https://git.openstack.org/openstack/gnocchi +gnocchi_git_install_branch: 27e52986cf716111dded4761665f02983bc2b366 # HEAD of "master" as of 27.06.2016 +gnocchi_git_dest: "/opt/gnocchi_{{ gnocchi_git_install_branch | replace('/', '_') }}" + + ## Heat service heat_git_repo: https://git.openstack.org/openstack/heat heat_git_install_branch: e4c09815e9557e5f93785e8a49db3c41be1d7892 # HEAD of "master" as of 02.06.2016 diff --git a/playbooks/inventory/env.d/gnocchi.yml b/playbooks/inventory/env.d/gnocchi.yml new file mode 100644 index 0000000000..5a54412c28 --- /dev/null +++ b/playbooks/inventory/env.d/gnocchi.yml @@ -0,0 +1,41 @@ +--- +# Copyright 2015, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +component_skel: + gnocchi_api: + belongs_to: + - gnocchi_all + gnocchi_metricd: + belongs_to: + - gnocchi_all + +container_skel: + gnocchi_container: + belongs_to: + - metrics_containers + contains: + - gnocchi_api + - gnocchi_metricd + properties: + service_name: gnocchi + +physical_skel: + metrics_containers: + belongs_to: + - all_containers + metrics_hosts: + belongs_to: + - hosts + diff --git a/playbooks/inventory/group_vars/gnocchi_all.yml b/playbooks/inventory/group_vars/gnocchi_all.yml new file mode 100644 index 0000000000..1c2453354f --- /dev/null +++ b/playbooks/inventory/group_vars/gnocchi_all.yml @@ -0,0 +1,22 @@ +--- +# Copyright 2016, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +gnocchi_service_port: 8041 +gnocchi_service_proto: http +gnocchi_service_internaluri_proto: "{{ openstack_service_internaluri_proto | default(gnocchi_service_proto) }}" +gnocchi_service_internalurl: "{{ gnocchi_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ gnocchi_service_port }}" + +gnocchi_ssl_external: "{{ openstack_external_ssl }}" +gnocchi_service_region: "{{ service_region }}" diff --git a/playbooks/os-gnocchi-install.yml b/playbooks/os-gnocchi-install.yml new file mode 100644 index 0000000000..ca4e602775 --- /dev/null +++ b/playbooks/os-gnocchi-install.yml @@ -0,0 +1,123 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Install Gnocchi components + hosts: gnocchi_all + max_fail_percentage: 20 + user: root + pre_tasks: + - name: Use the lxc-openstack aa profile + lxc_container: + name: "{{ container_name }}" + container_config: + - "lxc.aa_profile=lxc-openstack" + delegate_to: "{{ physical_host }}" + when: not is_metal | bool + register: container_config + tags: + - lxc-aa-profile + - name: Wait for container ssh + wait_for: + port: "22" + delay: "{{ ssh_delay }}" + search_regex: "OpenSSH" + host: "{{ ansible_ssh_host }}" + delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed + register: ssh_wait_check + until: ssh_wait_check | success + retries: 3 + tags: + - ssh-wait + - name: Gnocchi extra lxc config + lxc_container: + name: "{{ container_name }}" + container_command: | + [[ ! -d "/var/lib/gnocchi" ]] && mkdir -p "/var/lib/gnocchi" + container_config: + - "lxc.mount.entry=/openstack/{{ container_name }} var/lib/gnocchi none bind 0 0" + delegate_to: "{{ physical_host }}" + when: > + (not is_metal | bool) and gnocchi_storage_driver is not defined or + (gnocchi_storage_driver == "file") + register: container_extra_config + tags: + -gnocchi-storage-dir + - name: Create log dir + file: + path: "{{ item.path }}" + state: directory + with_items: + - { path: "/openstack/log/{{ inventory_hostname }}-gnocchi" } + when: is_metal | bool + tags: + - gnocchi-logs + - gnocchi-log-dirs + - name: Create log aggregation links + file: + src: "/openstack/log/{{ inventory_hostname }}-gnocchi" + dest: "/var/log/gnocchi" + state: "link" + force: "yes" + when: is_metal | bool + tags: + - gnocchi-logs + - name: Create DB for service + mysql_db: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ gnocchi_galera_address }}" + name: "{{ gnocchi_galera_database }}" + state: "present" + when: inventory_hostname == groups['gnocchi_all'][0] + delegate_to: "{{ groups['galera_all'][0] }}" + tags: + - mysql-db-setup + - name: Grant access to the DB for the service + mysql_user: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ gnocchi_galera_address }}" + name: "{{ gnocchi_galera_user }}" + password: "{{ gnocchi_galera_password }}" + host: "{{ item }}" + state: "present" + priv: "{{ gnocchi_galera_database }}.*:ALL" + when: inventory_hostname == groups['gnocchi_all'][0] + delegate_to: "{{ groups['galera_all'][0] }}" + with_items: + - "localhost" + - "%" + tags: + - mysql-db-setup + roles: + - role: "os_gnocchi" + gnocchi_venv_tag: "{{ openstack_release }}" + gnocchi_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/gnocchi-{{ openstack_release }}.tgz" + pip_lock_to_internal_repo: "{{ (pip_links | length) >= 1 }}" + tags: + - "os-gnocchi" + - { role: "openstack_openrc", tags: [ "openstack-openrc" ] } + - role: "rsyslog_client" + rsyslog_client_log_rotate_file: gnocchi_log_rotate + rsyslog_client_log_dir: "/var/log/gnocchi" + rsyslog_client_config_name: "99-gnocchi-rsyslog-client.conf" + tags: + - "gnocchi-rsyslog-client" + vars: + is_metal: "{{ properties.is_metal|default(false) }}" + gnocchi_galera_user: gnocchi + gnocchi_galera_database: gnocchi + gnocchi_galera_address: "{{ galera_address }}" diff --git a/playbooks/setup-openstack.yml b/playbooks/setup-openstack.yml index be10a349aa..5bd475516e 100644 --- a/playbooks/setup-openstack.yml +++ b/playbooks/setup-openstack.yml @@ -23,4 +23,5 @@ - include: os-ceilometer-install.yml - include: os-aodh-install.yml - include: os-swift-install.yml +- include: os-gnocchi-install.yml - include: os-ironic-install.yml diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index f453449f06..b57ad88dc6 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -132,6 +132,7 @@ - python-novaclient - python-ironicclient - python-swiftclient + - gnocchiclient - python-memcached - pycrypto is_metal: "{{ properties.is_metal|default(false) }}" diff --git a/playbooks/vars/configs/haproxy_config.yml b/playbooks/vars/configs/haproxy_config.yml index dffc9f1514..315fab0750 100644 --- a/playbooks/vars/configs/haproxy_config.yml +++ b/playbooks/vars/configs/haproxy_config.yml @@ -55,6 +55,14 @@ haproxy_default_services: - 192.168.0.0/16 - 172.16.0.0/12 - 10.0.0.0/8 + - service: + haproxy_service_name: gnocchi + haproxy_backend_nodes: "{{ groups['gnocchi_all'] | default([]) }}" + haproxy_port: 8041 + haproxy_ssl: "{{ haproxy_ssl }}" + haproxy_balance_type: http + haproxy_backend_options: + - "httpchk /healthcheck" - service: haproxy_service_name: heat_api_cfn haproxy_backend_nodes: "{{ groups['heat_api_cfn'] | default([]) }}" diff --git a/releasenotes/notes/gnocchi-metrics-service-6a7bdda8e7e71dda.yaml b/releasenotes/notes/gnocchi-metrics-service-6a7bdda8e7e71dda.yaml new file mode 100644 index 0000000000..4ce02523da --- /dev/null +++ b/releasenotes/notes/gnocchi-metrics-service-6a7bdda8e7e71dda.yaml @@ -0,0 +1,9 @@ +--- +features: + - Gnocchi is available for deploy as a metrics storage + service. At this time it does not integrate with Aodh + or Ceilometer. To deploy Aodh or Ceilometer to use + Gnocchi as a storage / query API, each must be + configured appropriately with the use of overrides as + described in the configuration guides for each of + these services. diff --git a/tests/test_inventory.py b/tests/test_inventory.py index a80457274c..661300406b 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -106,6 +106,10 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase): 'glance_api', 'glance_container', 'glance_registry', + 'gnocchi_all', + 'gnocchi_api', + 'gnocchi_container', + 'gnocchi_metricd', 'haproxy', 'haproxy_all', 'haproxy_container', @@ -155,6 +159,8 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase): 'metering-compute_hosts', 'metering-infra_containers', 'metering-infra_hosts', + 'metrics_containers', + 'metrics_hosts', 'network_all', 'network_containers', 'network_hosts',